Options is transport's 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.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.( Options) Clone() Options
func Options.Clone() Options
The pages are generated with Goldsv0.8.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds.