h1

package
v0.0.0-...-bf8faa0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthBasic

func AuthBasic(username string, password string) *basicAuth

AuthBasic returns a ProxyAuthorization that implements "Basic" protocol while ignoring realm challenges.

Types

type HttpTunnel

type HttpTunnel struct {
	// contains filtered or unexported fields
}

HttpTunnel represents a configured HTTP Connect Tunnel dialer.

func New

func New(proxyUrl *url.URL, opts ...Opt) *HttpTunnel

func (*HttpTunnel) Dial

func (t *HttpTunnel) Dial(network string, address string) (net.Conn, error)

Dial implements proxy.Dialer. Returns a conn to address that HTTP CONNECT reached.

type Opt

type Opt func(*HttpTunnel)

func WithDialer

func WithDialer(dialer protect.RDialer) Opt

WithDialer allows the customization of the underlying net.Dialer used for establishing TCP connections to the proxy.

func WithProxyAuth

func WithProxyAuth(auth ProxyAuthorization) Opt

WithProxyAuth allows you to add ProxyAuthorization to calls.

func WithTls

func WithTls(tlsConfig *tls.Config) Opt

WithTls sets the tls.Config to be used (e.g. CA certs) when connecting to an HTTP proxy over TLS.

type ProxyAuthorization

type ProxyAuthorization interface {
	// Type represents what kind of Authorization, e.g. "Bearer", "Token", "Digest".
	Type() string

	// Initial allows you to specify an a-priori "Proxy-Authenticate" response header, attached to first request,
	// so you don't need to wait for an additional challenge. If empty string is returned, "Proxy-Authenticate"
	// header is added.
	InitialResponse() string

	// ChallengeResponse returns the content of the "Proxy-Authenticate" response header, that has been chose as
	// response to "Proxy-Authorization" request header challenge.
	ChallengeResponse(challenge string) string
}

ProxyAuthorization allows for plugging in arbitrary implementations of the "Proxy-Authorization" handler.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL