Documentation
¶
Overview ¶
Package httpconnect contains an HTTP CONNECT client implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientOption ¶
type ClientOption func(c *clientConfig)
func WithHeaders ¶
func WithHeaders(headers http.Header) ClientOption
WithHeaders appends the given headers to the CONNECT request.
type ConnectClient ¶ added in v0.0.4
type ConnectClient struct {
// contains filtered or unexported fields
}
ConnectClient is a transport.StreamDialer that establishes an HTTP CONNECT tunnel over an abstract HTTP transport.
The package also includes transport builders: - NewHTTPProxyTransport - NewHTTP3ProxyTransport
Options: - WithHeaders appends the provided headers to every CONNECT request.
func NewConnectClient ¶
func NewConnectClient(proxyRT ProxyRoundTripper, opts ...ClientOption) (*ConnectClient, error)
func (*ConnectClient) DialStream ¶ added in v0.0.4
func (cc *ConnectClient) DialStream(ctx context.Context, remoteAddr string) (transport.StreamConn, error)
type ProxyRoundTripper ¶ added in v0.0.4
type ProxyRoundTripper interface {
http.RoundTripper
Scheme() string
}
func NewHTTP3ProxyTransport ¶ added in v0.0.4
func NewHTTP3ProxyTransport(conn net.PacketConn, proxyAddr string, opts ...TransportOption) (ProxyRoundTripper, error)
NewHTTP3ProxyTransport creates an HTTP/3 transport that establishes a QUIC connection to the proxy using the given net.PacketConn. The proxy address must be in the form "host:port".
For HTTP/3 over QUIC over a datagram connection. tls.WithALPN has no effect on this transport.
func NewHTTPProxyTransport ¶ added in v0.0.4
func NewHTTPProxyTransport(dialer transport.StreamDialer, proxyAddr string, opts ...TransportOption) (ProxyRoundTripper, error)
NewHTTPProxyTransport creates a net/http Transport that establishes a connection to the proxy using the given transport.StreamDialer. The proxy address must be in the form "host:port".
For HTTP/1 (plain and over TLS) and HTTP/2 (over TLS) over a stream connection. When using TLS, pass WithTLSOptions(tls.WithALPN()) to enable or enforce HTTP/2.
type TransportOption ¶ added in v0.0.4
type TransportOption func(c *transportConfig)
func WithPlainHTTP ¶ added in v0.0.4
func WithPlainHTTP() TransportOption
WithPlainHTTP configures the transport to use HTTP instead of HTTPS.
func WithTLSOptions ¶ added in v0.0.4
func WithTLSOptions(opts ...tls.ClientOption) TransportOption
WithTLSOptions configures the transport to use the given TLS options. The default behavior is to use TLS.