Help us shape the future of Go! Take the 2026 Go Developer Survey

dialer

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ServerSelectionFirst
	ServerSelectionRandom
	ServerSelectionFastest
)
View Source
const (
	PROXY_CONNECT_METHOD       = "CONNECT"
	PROXY_HOST_HEADER          = "Host"
	PROXY_AUTHORIZATION_HEADER = "Proxy-Authorization"
)

Variables

This section is empty.

Functions

func BasicAuthHeader

func BasicAuthHeader(login, password string) string

func ProbeDialer added in v1.22.0

func ProbeDialer(ctx context.Context, d ContextDialer, targetURL string, dlLimit int64, tlsClientConfig *tls.Config) error

ProbeDialer checks whether dialer can reach targetURL by issuing a GET request and discarding up to dlLimit bytes of the response body (0 = no limit). It is used by both the server-selection benchmark (NewFastestServerSelectionFunc) and the stand-alone speed test (benchmarkProxyEndpoints in main.go).

Previously main.go had its own copy called probeProxyEndpoint with an identical body. That copy has been replaced by a call to this function to eliminate the duplication.

func WrapStringToCb

func WrapStringToCb(s string) func() (string, error)

Types

type BypassDialer added in v1.18.0

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

func NewBypassDialer added in v1.18.0

func NewBypassDialer(patterns []string, direct, proxied ContextDialer) (*BypassDialer, error)

func (*BypassDialer) Dial added in v1.18.0

func (d *BypassDialer) Dial(network, address string) (net.Conn, error)

func (*BypassDialer) DialContext added in v1.18.0

func (d *BypassDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type ContextDialer

type ContextDialer interface {
	Dialer
	DialContext(ctx context.Context, network, address string) (net.Conn, error)
}

func SelectFirst

func SelectFirst(_ context.Context, dialers []ContextDialer) (ContextDialer, error)

func SelectRandom

func SelectRandom(_ context.Context, dialers []ContextDialer) (ContextDialer, error)

type Dialer

type Dialer interface {
	Dial(network, address string) (net.Conn, error)
}

type FixedDialer

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

func NewFixedDialer

func NewFixedDialer(address string, next ContextDialer) *FixedDialer

func (*FixedDialer) Dial

func (d *FixedDialer) Dial(network, address string) (net.Conn, error)

func (*FixedDialer) DialContext

func (d *FixedDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type LookupNetIPer

type LookupNetIPer interface {
	LookupNetIP(context.Context, string, string) ([]netip.Addr, error)
}

type ProxyDialer

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

func NewProxyDialer

func NewProxyDialer(address, tlsServerName, fakeSNI, auth stringCb, caPool *x509.CertPool, nextDialer ContextDialer) *ProxyDialer

func ProxyDialerFromURL

func ProxyDialerFromURL(u *url.URL, next ContextDialer) (*ProxyDialer, error)

func (*ProxyDialer) Address

func (d *ProxyDialer) Address() (string, error)

func (*ProxyDialer) Dial

func (d *ProxyDialer) Dial(network, address string) (net.Conn, error)

func (*ProxyDialer) DialContext

func (d *ProxyDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type ResolvingDialer

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

func NewResolvingDialer

func NewResolvingDialer(lookup LookupNetIPer, next ContextDialer) *ResolvingDialer

func (*ResolvingDialer) Dial

func (d *ResolvingDialer) Dial(network, address string) (net.Conn, error)

func (*ResolvingDialer) DialContext

func (d *ResolvingDialer) DialContext(ctx context.Context, network, address string) (net.Conn, error)

type SelectionFunc

type SelectionFunc = func(ctx context.Context, dialers []ContextDialer) (ContextDialer, error)

func NewFastestServerSelectionFunc

func NewFastestServerSelectionFunc(url string, dlLimit int64, tlsClientConfig *tls.Config) SelectionFunc

type ServerSelection

type ServerSelection int

func ParseServerSelection

func ParseServerSelection(s string) (ServerSelection, error)

func (ServerSelection) String

func (ss ServerSelection) String() string

Jump to

Keyboard shortcuts

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