Documentation ¶
Overview ¶
Package httpclient is used by the upstreaming forwardproxy to establish connections to http(s) upstreams. it implements x/net/proxy.Dialer interface
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewHttp2Conn ¶
func NewHttp2Conn(c net.Conn, pipedReqBody *io.PipeWriter, respBody io.ReadCloser) net.Conn
Types ¶
type ContextKeyHeader ¶
type ContextKeyHeader struct{}
Users of context.WithValue should define their own types for keys
type HTTPConnectDialer ¶
type HTTPConnectDialer struct { ProxyURL url.URL DefaultHeader http.Header // TODO: If spkiFp is set, use it as SPKI fingerprint to confirm identity of the // proxy, instead of relying on standard PKI CA roots SpkiFP []byte Dialer net.Dialer // overridden dialer allow to control establishment of TCP connection // overridden DialTLS allows user to control establishment of TLS connection // MUST return connection with completed Handshake, and NegotiatedProtocol DialTLS func(network string, address string) (net.Conn, string, error) EnableH2ConnReuse bool // contains filtered or unexported fields }
HTTPConnectDialer allows to configure one-time use HTTP CONNECT client
func NewHTTPConnectDialer ¶
func NewHTTPConnectDialer(proxyURLStr string) (*HTTPConnectDialer, error)
NewHTTPConnectDialer creates a client to issue CONNECT requests and tunnel traffic via HTTPS proxy. proxyURLStr must provide Scheme and Host, may provide credentials and port. Example: https://username:password@golang.org:443
func (*HTTPConnectDialer) Dial ¶
func (c *HTTPConnectDialer) Dial(network, address string) (net.Conn, error)
func (*HTTPConnectDialer) DialContext ¶
func (c *HTTPConnectDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)
ctx.Value will be inspected for optional ContextKeyHeader{} key, with `http.Header` value, which will be added to outgoing request headers, overriding any colliding c.DefaultHeader