package http3

Import Path
	github.com/imroc/req/v3/internal/http3 (on go.dev)

Dependency Relation
	imports 33 packages, and imported by one package


Package-Level Type Names (total 15)
/* sort by: | */
ClientConn is an HTTP/3 client doing requests to a single remote server. Options *transport.Options AutoDecompression, if true, enables automatic decompression of compressed responses. It is equivalent to setting the Accept-Encoding header to "gzip, deflate, br, zstd" and the Transport will handle the decompression of the response transparently, returning the uncompressed. Debugf is the optional debug function. DialContext specifies the dial function for creating unencrypted TCP connections. If DialContext is nil, then the transport dials using package net. DialContext runs concurrently with calls to RoundTrip. A RoundTrip call that initiates a dial may end up using a connection dialed previously when the earlier connection becomes idle before the later DialContext completes. DialTLSContext specifies an optional dial function for creating TLS connections for non-proxied HTTPS requests. If DialTLSContext is nil, DialContext and TLSClientConfig are used. If DialTLSContext is set, the Dial and DialContext hooks are not used for HTTPS requests and the TLSClientConfig and TLSHandshakeTimeout are ignored. The returned net.Conn is assumed to already be past the TLS handshake. DisableCompression, if true, prevents the Transport from requesting compression with an "Accept-Encoding: gzip" request header when the Request contains no existing Accept-Encoding value. If the Transport requests gzip on its own and gets a gzipped response, it's transparently decoded in the Response.Body. However, if the user explicitly requested gzip it is not automatically uncompressed. DisableKeepAlives, if true, disables HTTP keep-alives and will only use the connection to the server for a single HTTP request. This is unrelated to the similarly named TCP keep-alives. Options.Dump *dump.Dumper EnableH2C, if true, enables http2 over plain http without tls. ExpectContinueTimeout, if non-zero, specifies the amount of time to wait for a server's first response headers after fully writing the request headers if the request has an "Expect: 100-continue" header. Zero means no timeout and causes the body to be sent immediately, without waiting for the server to approve. This time does not include the time to send the request header. GetProxyConnectHeader optionally specifies a func to return headers to send to proxyURL during a CONNECT request to the ip:port target. If it returns an error, the Transport's RoundTrip fails with that error. It can return (nil, nil) to not add headers. If GetProxyConnectHeader is non-nil, ProxyConnectHeader is ignored. IdleConnTimeout is the maximum amount of time an idle (keep-alive) connection will remain idle before closing itself. Zero means no limit. MaxConnsPerHost optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. On limit violation, dials will block. Zero means no limit. MaxIdleConns controls the maximum number of idle (keep-alive) connections across all hosts. Zero means no limit. MaxIdleConnsPerHost, if non-zero, controls the maximum idle (keep-alive) connections to keep per-host. If zero, defaultMaxIdleConnsPerHost is used. MaxResponseHeaderBytes specifies a limit on how many response bytes are allowed in the server's response header. Zero means to use a default limit. OnProxyConnectResponse is called when the Transport gets an HTTP response from a proxy for a CONNECT request. It's called before the check for a 200 OK response. If it returns an error, the request fails with that error. Proxy specifies a function to return a proxy for a given Request. If the function returns a non-nil error, the request is aborted with the provided error. The proxy type is determined by the URL scheme. "http", "https", "socks5", "socks5h", "socks4", and "socks4a" are supported. If the scheme is empty, "http" is assumed. "socks5" is treated the same as "socks5h". "socks4" resolves domain names locally to IPv4; "socks4a" lets the proxy resolve domain names. SOCKS4 only supports IPv4 destinations. If the proxy URL contains a userinfo subcomponent, the proxy request will pass the username and password in a Proxy-Authorization header for HTTP proxies, or the username as the SOCKS4 user ID / SOCKS5 credentials for SOCKS proxies. If Proxy is nil or returns a nil *URL, no proxy is used. ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. To set the header dynamically, see GetProxyConnectHeader. ReadBufferSize specifies the size of the read buffer used when reading from the transport. If zero, a default (currently 4KB) is used. ResponseHeaderTimeout, if non-zero, specifies the amount of time to wait for a server's response headers after fully writing the request (including its body, if any). This time does not include the time to read the response body. TLSClientConfig specifies the TLS configuration to use with tls.Client. If nil, the default configuration is used. If non-nil, HTTP/2 support may not be enabled by default. TLSHandshakeContext specifies an optional dial function for tls handshake, it works even if a proxy is set, can be used to customize the tls fingerprint. TLSHandshakeTimeout specifies the maximum amount of time to wait for a TLS handshake. Zero means no timeout. WriteBufferSize specifies the size of the write buffer used when writing to the transport. If zero, a default (currently 4KB) is used. ( ClientConn) Clone() transport.Options CloseWithError closes the connection with the given error code and message. It is invalid to call this function after the connection was closed. Conn returns the underlying HTTP/3 connection. This method is only useful for advanced use cases, such as when the application needs to open streams on the HTTP/3 connection (e.g. WebTransport). Context returns a context that is cancelled when the connection is closed. HandleBidirectionalStream handles an incoming bidirectional stream. According to RFC 9114, the server is not allowed to open bidirectional streams, so this method closes the connection with an error. OpenRequestStream opens a new request stream on the HTTP/3 connection. ReceivedSettings returns a channel that is closed once the server's HTTP/3 settings were received. Settings can be obtained from the Settings method after the channel was closed. RoundTrip executes a request and returns a response Settings returns the HTTP/3 settings for this connection. It is only valid to call this function after the channel returned by ReceivedSettings was closed. *ClientConn : Settingser *ClientConn : net/http.RoundTripper func (*Transport).NewClientConn(conn *quic.Conn) *ClientConn
Conn is an HTTP/3 connection. It has all methods from the quic.Conn expect for AcceptStream, AcceptUniStream, SendDatagram and ReceiveDatagram. Options *transport.Options AutoDecompression, if true, enables automatic decompression of compressed responses. It is equivalent to setting the Accept-Encoding header to "gzip, deflate, br, zstd" and the Transport will handle the decompression of the response transparently, returning the uncompressed. Debugf is the optional debug function. DialContext specifies the dial function for creating unencrypted TCP connections. If DialContext is nil, then the transport dials using package net. DialContext runs concurrently with calls to RoundTrip. A RoundTrip call that initiates a dial may end up using a connection dialed previously when the earlier connection becomes idle before the later DialContext completes. DialTLSContext specifies an optional dial function for creating TLS connections for non-proxied HTTPS requests. If DialTLSContext is nil, DialContext and TLSClientConfig are used. If DialTLSContext is set, the Dial and DialContext hooks are not used for HTTPS requests and the TLSClientConfig and TLSHandshakeTimeout are ignored. The returned net.Conn is assumed to already be past the TLS handshake. DisableCompression, if true, prevents the Transport from requesting compression with an "Accept-Encoding: gzip" request header when the Request contains no existing Accept-Encoding value. If the Transport requests gzip on its own and gets a gzipped response, it's transparently decoded in the Response.Body. However, if the user explicitly requested gzip it is not automatically uncompressed. DisableKeepAlives, if true, disables HTTP keep-alives and will only use the connection to the server for a single HTTP request. This is unrelated to the similarly named TCP keep-alives. Options.Dump *dump.Dumper EnableH2C, if true, enables http2 over plain http without tls. ExpectContinueTimeout, if non-zero, specifies the amount of time to wait for a server's first response headers after fully writing the request headers if the request has an "Expect: 100-continue" header. Zero means no timeout and causes the body to be sent immediately, without waiting for the server to approve. This time does not include the time to send the request header. GetProxyConnectHeader optionally specifies a func to return headers to send to proxyURL during a CONNECT request to the ip:port target. If it returns an error, the Transport's RoundTrip fails with that error. It can return (nil, nil) to not add headers. If GetProxyConnectHeader is non-nil, ProxyConnectHeader is ignored. IdleConnTimeout is the maximum amount of time an idle (keep-alive) connection will remain idle before closing itself. Zero means no limit. MaxConnsPerHost optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. On limit violation, dials will block. Zero means no limit. MaxIdleConns controls the maximum number of idle (keep-alive) connections across all hosts. Zero means no limit. MaxIdleConnsPerHost, if non-zero, controls the maximum idle (keep-alive) connections to keep per-host. If zero, defaultMaxIdleConnsPerHost is used. MaxResponseHeaderBytes specifies a limit on how many response bytes are allowed in the server's response header. Zero means to use a default limit. OnProxyConnectResponse is called when the Transport gets an HTTP response from a proxy for a CONNECT request. It's called before the check for a 200 OK response. If it returns an error, the request fails with that error. Proxy specifies a function to return a proxy for a given Request. If the function returns a non-nil error, the request is aborted with the provided error. The proxy type is determined by the URL scheme. "http", "https", "socks5", "socks5h", "socks4", and "socks4a" are supported. If the scheme is empty, "http" is assumed. "socks5" is treated the same as "socks5h". "socks4" resolves domain names locally to IPv4; "socks4a" lets the proxy resolve domain names. SOCKS4 only supports IPv4 destinations. If the proxy URL contains a userinfo subcomponent, the proxy request will pass the username and password in a Proxy-Authorization header for HTTP proxies, or the username as the SOCKS4 user ID / SOCKS5 credentials for SOCKS proxies. If Proxy is nil or returns a nil *URL, no proxy is used. ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. To set the header dynamically, see GetProxyConnectHeader. ReadBufferSize specifies the size of the read buffer used when reading from the transport. If zero, a default (currently 4KB) is used. ResponseHeaderTimeout, if non-zero, specifies the amount of time to wait for a server's response headers after fully writing the request (including its body, if any). This time does not include the time to read the response body. TLSClientConfig specifies the TLS configuration to use with tls.Client. If nil, the default configuration is used. If non-nil, HTTP/2 support may not be enabled by default. TLSHandshakeContext specifies an optional dial function for tls handshake, it works even if a proxy is set, can be used to customize the tls fingerprint. TLSHandshakeTimeout specifies the maximum amount of time to wait for a TLS handshake. Zero means no timeout. WriteBufferSize specifies the size of the write buffer used when writing to the transport. If zero, a default (currently 4KB) is used. ( Conn) Clone() transport.Options (*Conn) CloseWithError(code quic.ApplicationErrorCode, msg string) error (*Conn) ConnectionState() quic.ConnectionState Context returns the context of the underlying QUIC connection. (*Conn) HandshakeComplete() <-chan struct{} (*Conn) LocalAddr() net.Addr (*Conn) OpenStream() (*quic.Stream, error) (*Conn) OpenStreamSync(ctx context.Context) (*quic.Stream, error) (*Conn) OpenUniStream() (*quic.SendStream, error) (*Conn) OpenUniStreamSync(ctx context.Context) (*quic.SendStream, error) ReceivedSettings returns a channel that is closed once the peer's SETTINGS frame was received. Settings can be obtained from the Settings method after the channel was closed. (*Conn) RemoteAddr() net.Addr Settings returns the settings received on this connection. It is only valid to call this function after the channel returned by ReceivedSettings was closed. *Conn : Settingser func (*ClientConn).Conn() *Conn
( ErrCode) String() string ErrCode : github.com/pancsta/asyncmachine-go/internal/nofmt.Stringer ErrCode : github.com/pandatix/go-abnf.ElemItf ErrCode : expvar.Var ErrCode : fmt.Stringer func (*ClientConn).CloseWithError(code ErrCode, msg string) error const ErrCodeClosedCriticalStream const ErrCodeConnectError const ErrCodeDatagramError const ErrCodeExcessiveLoad const ErrCodeFrameError const ErrCodeFrameUnexpected const ErrCodeGeneralProtocolError const ErrCodeIDError const ErrCodeInternalError const ErrCodeMessageError const ErrCodeMissingSettings const ErrCodeNoError const ErrCodeQPACKDecompressionFailed const ErrCodeRequestCanceled const ErrCodeRequestIncomplete const ErrCodeRequestRejected const ErrCodeSettingsError const ErrCodeStreamCreationError const ErrCodeVersionFallback
Error is returned from the round tripper (for HTTP clients) and inside the HTTP handler (for HTTP servers) if an HTTP/3 error occurs. See section 8 of RFC 9114. ErrorCode ErrCode ErrorMessage string Remote bool (*Error) Error() string (*Error) Is(target error) bool *Error : error
FrameType is the frame type of a HTTP/3 frame
Perspective determines if we're acting as a server or a client Opposite returns the perspective of the peer ( Perspective) String() string Perspective : github.com/pancsta/asyncmachine-go/internal/nofmt.Stringer Perspective : github.com/pandatix/go-abnf.ElemItf Perspective : expvar.Var Perspective : fmt.Stringer func Perspective.Opposite() Perspective func StreamNum.StreamID(stype StreamType, pers Perspective) quic.StreamID const PerspectiveClient const PerspectiveServer
RawClientConn is a low-level HTTP/3 client connection. It allows the application to take control of the stream accept loops, giving the application the ability to handle streams originating from the server. This is useful for implementing WebTransport or other advanced protocols. ClientConn *ClientConn ClientConn.Options *transport.Options AutoDecompression, if true, enables automatic decompression of compressed responses. It is equivalent to setting the Accept-Encoding header to "gzip, deflate, br, zstd" and the Transport will handle the decompression of the response transparently, returning the uncompressed. Debugf is the optional debug function. DialContext specifies the dial function for creating unencrypted TCP connections. If DialContext is nil, then the transport dials using package net. DialContext runs concurrently with calls to RoundTrip. A RoundTrip call that initiates a dial may end up using a connection dialed previously when the earlier connection becomes idle before the later DialContext completes. DialTLSContext specifies an optional dial function for creating TLS connections for non-proxied HTTPS requests. If DialTLSContext is nil, DialContext and TLSClientConfig are used. If DialTLSContext is set, the Dial and DialContext hooks are not used for HTTPS requests and the TLSClientConfig and TLSHandshakeTimeout are ignored. The returned net.Conn is assumed to already be past the TLS handshake. DisableCompression, if true, prevents the Transport from requesting compression with an "Accept-Encoding: gzip" request header when the Request contains no existing Accept-Encoding value. If the Transport requests gzip on its own and gets a gzipped response, it's transparently decoded in the Response.Body. However, if the user explicitly requested gzip it is not automatically uncompressed. DisableKeepAlives, if true, disables HTTP keep-alives and will only use the connection to the server for a single HTTP request. This is unrelated to the similarly named TCP keep-alives. ClientConn.Options.Dump *dump.Dumper EnableH2C, if true, enables http2 over plain http without tls. ExpectContinueTimeout, if non-zero, specifies the amount of time to wait for a server's first response headers after fully writing the request headers if the request has an "Expect: 100-continue" header. Zero means no timeout and causes the body to be sent immediately, without waiting for the server to approve. This time does not include the time to send the request header. GetProxyConnectHeader optionally specifies a func to return headers to send to proxyURL during a CONNECT request to the ip:port target. If it returns an error, the Transport's RoundTrip fails with that error. It can return (nil, nil) to not add headers. If GetProxyConnectHeader is non-nil, ProxyConnectHeader is ignored. IdleConnTimeout is the maximum amount of time an idle (keep-alive) connection will remain idle before closing itself. Zero means no limit. MaxConnsPerHost optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. On limit violation, dials will block. Zero means no limit. MaxIdleConns controls the maximum number of idle (keep-alive) connections across all hosts. Zero means no limit. MaxIdleConnsPerHost, if non-zero, controls the maximum idle (keep-alive) connections to keep per-host. If zero, defaultMaxIdleConnsPerHost is used. MaxResponseHeaderBytes specifies a limit on how many response bytes are allowed in the server's response header. Zero means to use a default limit. OnProxyConnectResponse is called when the Transport gets an HTTP response from a proxy for a CONNECT request. It's called before the check for a 200 OK response. If it returns an error, the request fails with that error. Proxy specifies a function to return a proxy for a given Request. If the function returns a non-nil error, the request is aborted with the provided error. The proxy type is determined by the URL scheme. "http", "https", "socks5", "socks5h", "socks4", and "socks4a" are supported. If the scheme is empty, "http" is assumed. "socks5" is treated the same as "socks5h". "socks4" resolves domain names locally to IPv4; "socks4a" lets the proxy resolve domain names. SOCKS4 only supports IPv4 destinations. If the proxy URL contains a userinfo subcomponent, the proxy request will pass the username and password in a Proxy-Authorization header for HTTP proxies, or the username as the SOCKS4 user ID / SOCKS5 credentials for SOCKS proxies. If Proxy is nil or returns a nil *URL, no proxy is used. ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. To set the header dynamically, see GetProxyConnectHeader. ReadBufferSize specifies the size of the read buffer used when reading from the transport. If zero, a default (currently 4KB) is used. ResponseHeaderTimeout, if non-zero, specifies the amount of time to wait for a server's response headers after fully writing the request (including its body, if any). This time does not include the time to read the response body. TLSClientConfig specifies the TLS configuration to use with tls.Client. If nil, the default configuration is used. If non-nil, HTTP/2 support may not be enabled by default. TLSHandshakeContext specifies an optional dial function for tls handshake, it works even if a proxy is set, can be used to customize the tls fingerprint. TLSHandshakeTimeout specifies the maximum amount of time to wait for a TLS handshake. Zero means no timeout. WriteBufferSize specifies the size of the write buffer used when writing to the transport. If zero, a default (currently 4KB) is used. ( RawClientConn) Clone() transport.Options CloseWithError closes the connection with the given error code and message. It is invalid to call this function after the connection was closed. Conn returns the underlying HTTP/3 connection. This method is only useful for advanced use cases, such as when the application needs to open streams on the HTTP/3 connection (e.g. WebTransport). Context returns a context that is cancelled when the connection is closed. HandleBidirectionalStream handles an incoming bidirectional stream. According to RFC 9114, the server is not allowed to open bidirectional streams, so this method closes the connection with an error. HandleUnidirectionalStream handles an incoming unidirectional stream. This should be called for each unidirectional stream accepted from the QUIC connection. OpenRequestStream opens a new request stream on the HTTP/3 connection. ReceivedSettings returns a channel that is closed once the server's HTTP/3 settings were received. Settings can be obtained from the Settings method after the channel was closed. RoundTrip executes a request and returns a response Settings returns the HTTP/3 settings for this connection. It is only valid to call this function after the channel returned by ReceivedSettings was closed. RawClientConn : Settingser RawClientConn : net/http.RoundTripper func (*Transport).NewRawClientConn(conn *quic.Conn) *RawClientConn
A RequestStream is a low-level abstraction representing an HTTP/3 request stream. It decouples sending of the HTTP request from reading the HTTP response, allowing the application to optimistically use the stream (and, for example, send datagrams) before receiving the response. This is only needed for advanced use case, e.g. WebTransport and the various MASQUE proxying protocols. Options *transport.Options AutoDecompression, if true, enables automatic decompression of compressed responses. It is equivalent to setting the Accept-Encoding header to "gzip, deflate, br, zstd" and the Transport will handle the decompression of the response transparently, returning the uncompressed. Debugf is the optional debug function. DialContext specifies the dial function for creating unencrypted TCP connections. If DialContext is nil, then the transport dials using package net. DialContext runs concurrently with calls to RoundTrip. A RoundTrip call that initiates a dial may end up using a connection dialed previously when the earlier connection becomes idle before the later DialContext completes. DialTLSContext specifies an optional dial function for creating TLS connections for non-proxied HTTPS requests. If DialTLSContext is nil, DialContext and TLSClientConfig are used. If DialTLSContext is set, the Dial and DialContext hooks are not used for HTTPS requests and the TLSClientConfig and TLSHandshakeTimeout are ignored. The returned net.Conn is assumed to already be past the TLS handshake. DisableCompression, if true, prevents the Transport from requesting compression with an "Accept-Encoding: gzip" request header when the Request contains no existing Accept-Encoding value. If the Transport requests gzip on its own and gets a gzipped response, it's transparently decoded in the Response.Body. However, if the user explicitly requested gzip it is not automatically uncompressed. DisableKeepAlives, if true, disables HTTP keep-alives and will only use the connection to the server for a single HTTP request. This is unrelated to the similarly named TCP keep-alives. Options.Dump *dump.Dumper EnableH2C, if true, enables http2 over plain http without tls. ExpectContinueTimeout, if non-zero, specifies the amount of time to wait for a server's first response headers after fully writing the request headers if the request has an "Expect: 100-continue" header. Zero means no timeout and causes the body to be sent immediately, without waiting for the server to approve. This time does not include the time to send the request header. GetProxyConnectHeader optionally specifies a func to return headers to send to proxyURL during a CONNECT request to the ip:port target. If it returns an error, the Transport's RoundTrip fails with that error. It can return (nil, nil) to not add headers. If GetProxyConnectHeader is non-nil, ProxyConnectHeader is ignored. IdleConnTimeout is the maximum amount of time an idle (keep-alive) connection will remain idle before closing itself. Zero means no limit. MaxConnsPerHost optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. On limit violation, dials will block. Zero means no limit. MaxIdleConns controls the maximum number of idle (keep-alive) connections across all hosts. Zero means no limit. MaxIdleConnsPerHost, if non-zero, controls the maximum idle (keep-alive) connections to keep per-host. If zero, defaultMaxIdleConnsPerHost is used. MaxResponseHeaderBytes specifies a limit on how many response bytes are allowed in the server's response header. Zero means to use a default limit. OnProxyConnectResponse is called when the Transport gets an HTTP response from a proxy for a CONNECT request. It's called before the check for a 200 OK response. If it returns an error, the request fails with that error. Proxy specifies a function to return a proxy for a given Request. If the function returns a non-nil error, the request is aborted with the provided error. The proxy type is determined by the URL scheme. "http", "https", "socks5", "socks5h", "socks4", and "socks4a" are supported. If the scheme is empty, "http" is assumed. "socks5" is treated the same as "socks5h". "socks4" resolves domain names locally to IPv4; "socks4a" lets the proxy resolve domain names. SOCKS4 only supports IPv4 destinations. If the proxy URL contains a userinfo subcomponent, the proxy request will pass the username and password in a Proxy-Authorization header for HTTP proxies, or the username as the SOCKS4 user ID / SOCKS5 credentials for SOCKS proxies. If Proxy is nil or returns a nil *URL, no proxy is used. ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. To set the header dynamically, see GetProxyConnectHeader. ReadBufferSize specifies the size of the read buffer used when reading from the transport. If zero, a default (currently 4KB) is used. ResponseHeaderTimeout, if non-zero, specifies the amount of time to wait for a server's response headers after fully writing the request (including its body, if any). This time does not include the time to read the response body. TLSClientConfig specifies the TLS configuration to use with tls.Client. If nil, the default configuration is used. If non-nil, HTTP/2 support may not be enabled by default. TLSHandshakeContext specifies an optional dial function for tls handshake, it works even if a proxy is set, can be used to customize the tls fingerprint. TLSHandshakeTimeout specifies the maximum amount of time to wait for a TLS handshake. Zero means no timeout. WriteBufferSize specifies the size of the write buffer used when writing to the transport. If zero, a default (currently 4KB) is used. CancelRead aborts receiving on this stream. See [quic.Stream.CancelRead] for more details. CancelWrite aborts sending on this stream. See [quic.Stream.CancelWrite] for more details. ( RequestStream) Clone() transport.Options Close closes the send-direction of the stream. It does not close the receive-direction of the stream. Context returns a context derived from the underlying QUIC stream's context. See [quic.Stream.Context] for more details. Read reads data from the underlying stream. It can only be used after the request has been sent (using SendRequestHeader) and the response has been consumed (using ReadResponse). ReadResponse reads the HTTP response from the stream. It must be called after sending the request (using SendRequestHeader). It is invalid to call it more than once. It doesn't set Response.Request and Response.TLS. It is invalid to call it after Read has been called. ReceiveDatagram receives HTTP Datagrams (RFC 9297). It is only possible if support for HTTP Datagrams was enabled, using the EnableDatagram option on the [Transport]. SendDatagrams send a new HTTP Datagram (RFC 9297). It is only possible to send datagrams if the server enabled support for this extension. It is recommended (though not required) to send the request before calling this method, as the server might drop datagrams which it can't associate with an existing request. SendRequestHeader sends the HTTP request. It can only used for requests that don't have a request body. It is invalid to call it more than once. It is invalid to call it after Write has been called. SetDeadline sets the read and write deadlines associated with the stream. It is equivalent to calling both SetReadDeadline and SetWriteDeadline. SetReadDeadline sets the deadline for Read calls. SetWriteDeadline sets the deadline for Write calls. StreamID returns the QUIC stream ID of the underlying QUIC stream. Write writes data to the stream. It can only be used after the request has been sent (using SendRequestHeader). *RequestStream : github.com/imroc/req/v3/internal/bisect.Writer *RequestStream : github.com/prometheus/common/expfmt.Closer *RequestStream : internal/bisect.Writer *RequestStream : io.Closer *RequestStream : io.ReadCloser *RequestStream : io.Reader *RequestStream : io.ReadWriteCloser *RequestStream : io.ReadWriter *RequestStream : io.WriteCloser *RequestStream : io.Writer func (*ClientConn).OpenRequestStream(ctx context.Context) (*RequestStream, error)
RoundTripOpt are options for the Transport.RoundTripOpt method. OnlyCachedConn controls whether RoundTripOpt may create a new TCP connection. If set true and no cached connection is available, RoundTripOpt will return ErrNoCachedConn. func (*Transport).RoundTripOpt(req *http.Request, opt RoundTripOpt) (*http.Response, error)
Settings are HTTP/3 settings that apply to the underlying connection. Support for HTTP/3 datagrams (RFC 9297) Extended CONNECT, RFC 9220 Other settings, defined by the application func (*ClientConn).Settings() *Settings func (*Conn).Settings() *Settings func Settingser.Settings() *Settings
Settingser allows waiting for and retrieving the peer's HTTP/3 settings. ReceivedSettings returns a channel that is closed once the peer's SETTINGS frame was received. Settings can be obtained from the Settings method after the channel was closed. Settings returns the settings received on this connection. It is only valid to call this function after the channel returned by ReceivedSettings was closed. *ClientConn *Conn RawClientConn
A Stream is an HTTP/3 stream. When writing to and reading from the stream, data is framed in HTTP/3 DATA frames. ( Stream) CancelRead(quic.StreamErrorCode) ( Stream) CancelWrite(quic.StreamErrorCode) ( Stream) Close() error ( Stream) Context() context.Context ( Stream) QUICStream() *quic.Stream (*Stream) Read(b []byte) (int, error) (*Stream) ReceiveDatagram(ctx context.Context) ([]byte, error) (*Stream) SendDatagram(b []byte) error ( Stream) SetDeadline(time.Time) error ( Stream) SetReadDeadline(time.Time) error ( Stream) SetWriteDeadline(time.Time) error (*Stream) StreamID() quic.StreamID (*Stream) Write(b []byte) (int, error) *Stream : github.com/imroc/req/v3/internal/bisect.Writer Stream : github.com/prometheus/common/expfmt.Closer *Stream : internal/bisect.Writer Stream : io.Closer *Stream : io.ReadCloser *Stream : io.Reader *Stream : io.ReadWriteCloser *Stream : io.ReadWriter *Stream : io.WriteCloser *Stream : io.Writer
StreamNum is the stream number StreamID calculates the stream ID. const MaxStreamCount
StreamType encodes if this is a unidirectional or bidirectional stream func StreamNum.StreamID(stype StreamType, pers Perspective) quic.StreamID const StreamTypeBidi const StreamTypeUni
Transport implements the http.RoundTripper interface Additional HTTP/3 settings. It is invalid to specify any settings defined by RFC 9114 (HTTP/3) and RFC 9297 (HTTP Datagrams). Dial specifies an optional dial function for creating QUIC connections for requests. If Dial is nil, a UDPConn will be created at the first request and will be reused for subsequent connections to other servers. DisableCompression, if true, prevents the Transport from requesting compression with an "Accept-Encoding: gzip" request header when the Request contains no existing Accept-Encoding value. If the Transport requests gzip on its own and gets a gzipped response, it's transparently decoded in the Response.Body. However, if the user explicitly requested gzip it is not automatically uncompressed. Enable support for HTTP/3 datagrams (RFC 9297). If a QUICConfig is set, datagram support also needs to be enabled on the QUIC layer by setting EnableDatagrams. Logger *slog.Logger MaxResponseHeaderBytes specifies a limit on how many response bytes are allowed in the server's response header. Zero means to use a default limit. Options *transport.Options AutoDecompression, if true, enables automatic decompression of compressed responses. It is equivalent to setting the Accept-Encoding header to "gzip, deflate, br, zstd" and the Transport will handle the decompression of the response transparently, returning the uncompressed. Debugf is the optional debug function. DialContext specifies the dial function for creating unencrypted TCP connections. If DialContext is nil, then the transport dials using package net. DialContext runs concurrently with calls to RoundTrip. A RoundTrip call that initiates a dial may end up using a connection dialed previously when the earlier connection becomes idle before the later DialContext completes. DialTLSContext specifies an optional dial function for creating TLS connections for non-proxied HTTPS requests. If DialTLSContext is nil, DialContext and TLSClientConfig are used. If DialTLSContext is set, the Dial and DialContext hooks are not used for HTTPS requests and the TLSClientConfig and TLSHandshakeTimeout are ignored. The returned net.Conn is assumed to already be past the TLS handshake. DisableKeepAlives, if true, disables HTTP keep-alives and will only use the connection to the server for a single HTTP request. This is unrelated to the similarly named TCP keep-alives. Options.Dump *dump.Dumper EnableH2C, if true, enables http2 over plain http without tls. ExpectContinueTimeout, if non-zero, specifies the amount of time to wait for a server's first response headers after fully writing the request headers if the request has an "Expect: 100-continue" header. Zero means no timeout and causes the body to be sent immediately, without waiting for the server to approve. This time does not include the time to send the request header. GetProxyConnectHeader optionally specifies a func to return headers to send to proxyURL during a CONNECT request to the ip:port target. If it returns an error, the Transport's RoundTrip fails with that error. It can return (nil, nil) to not add headers. If GetProxyConnectHeader is non-nil, ProxyConnectHeader is ignored. IdleConnTimeout is the maximum amount of time an idle (keep-alive) connection will remain idle before closing itself. Zero means no limit. MaxConnsPerHost optionally limits the total number of connections per host, including connections in the dialing, active, and idle states. On limit violation, dials will block. Zero means no limit. MaxIdleConns controls the maximum number of idle (keep-alive) connections across all hosts. Zero means no limit. MaxIdleConnsPerHost, if non-zero, controls the maximum idle (keep-alive) connections to keep per-host. If zero, defaultMaxIdleConnsPerHost is used. OnProxyConnectResponse is called when the Transport gets an HTTP response from a proxy for a CONNECT request. It's called before the check for a 200 OK response. If it returns an error, the request fails with that error. Proxy specifies a function to return a proxy for a given Request. If the function returns a non-nil error, the request is aborted with the provided error. The proxy type is determined by the URL scheme. "http", "https", "socks5", "socks5h", "socks4", and "socks4a" are supported. If the scheme is empty, "http" is assumed. "socks5" is treated the same as "socks5h". "socks4" resolves domain names locally to IPv4; "socks4a" lets the proxy resolve domain names. SOCKS4 only supports IPv4 destinations. If the proxy URL contains a userinfo subcomponent, the proxy request will pass the username and password in a Proxy-Authorization header for HTTP proxies, or the username as the SOCKS4 user ID / SOCKS5 credentials for SOCKS proxies. If Proxy is nil or returns a nil *URL, no proxy is used. ProxyConnectHeader optionally specifies headers to send to proxies during CONNECT requests. To set the header dynamically, see GetProxyConnectHeader. ReadBufferSize specifies the size of the read buffer used when reading from the transport. If zero, a default (currently 4KB) is used. ResponseHeaderTimeout, if non-zero, specifies the amount of time to wait for a server's response headers after fully writing the request (including its body, if any). This time does not include the time to read the response body. TLSHandshakeContext specifies an optional dial function for tls handshake, it works even if a proxy is set, can be used to customize the tls fingerprint. TLSHandshakeTimeout specifies the maximum amount of time to wait for a TLS handshake. Zero means no timeout. WriteBufferSize specifies the size of the write buffer used when writing to the transport. If zero, a default (currently 4KB) is used. QUICConfig is the quic.Config used for dialing new connections. If nil, reasonable default values will be used. TLSClientConfig specifies the TLS configuration to use with tls.Client. If nil, the default configuration is used. AddConn add a http3 connection, dial new conn if not exists. ( Transport) Clone() transport.Options Close closes the QUIC connections that this Transport has used. A Transport cannot be used after it has been closed. CloseIdleConnections closes any QUIC connections in the transport's pool that are currently idle. An idle connection is one that was previously used for requests but is now sitting unused. This method does not interrupt any connections currently in use. It also does not affect connections obtained via NewClientConn. NewClientConn creates a new HTTP/3 client connection on top of a QUIC connection. Most users should use RoundTrip instead of creating a connection directly. Specifically, it is not needed to perform GET, POST, HEAD and CONNECT requests. Obtaining a ClientConn is only needed for more advanced use cases, such as using Extended CONNECT for WebTransport or the various MASQUE protocols. NewRawClientConn creates a new low-level HTTP/3 client connection on top of a QUIC connection. Unlike NewClientConn, the returned RawClientConn allows the application to take control of the stream accept loops, by calling HandleUnidirectionalStream for incoming unidirectional streams and HandleBidirectionalStream for incoming bidirectional streams. RoundTrip does a round trip. RoundTripOnlyCachedConn round trip only cached conn. RoundTripOpt is like RoundTrip, but takes options. *Transport : github.com/prometheus/common/expfmt.Closer *Transport : io.Closer *Transport : net/http.RoundTripper
Package-Level Variables (total 2)
ErrNoCachedConn is returned when Transport.OnlyCachedConn is set
ErrTransportClosed is returned when attempting to use a closed Transport
Package-Level Constants (total 32)
const ErrCodeIDError ErrCode = 264
const ErrCodeNoError ErrCode = 256
InvalidPacketNumber is a stream ID that is invalid. The first valid stream ID in QUIC is 0.
InvalidStreamNum is an invalid stream number.
MaxStreamCount is the maximum stream count value that can be sent in MAX_STREAMS frames and as the stream count in the transport parameters
MethodGet0RTT allows a GET request to be sent using 0-RTT. Note that 0-RTT doesn't provide replay protection and should only be used for idempotent requests.
MethodHead0RTT allows a HEAD request to be sent using 0-RTT. Note that 0-RTT doesn't provide replay protection and should only be used for idempotent requests.
NextProtoH3 is the ALPN protocol negotiated during the TLS handshake, for QUIC v1 and v2.
the perspectives
the perspectives
StreamTypeBidi is a bidirectional stream
StreamTypeUni is a unidirectional stream
The version numbers, making grepping easier
The version numbers, making grepping easier
The version numbers, making grepping easier