Documentation
¶
Overview ¶
Package dialer defines the Dialer interface for establishing connections to the next-hop proxy server in a chain.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DialOption ¶
type DialOption func(opts *DialOptions)
DialOption is a functional option for configuring DialOptions.
func HostDialOption ¶
func HostDialOption(host string) DialOption
HostDialOption sets the target host.
func NetDialerDialOption ¶
func NetDialerDialOption(dialer xnet.Dialer) DialOption
NetDialerDialOption sets the underlying dialer.
type DialOptions ¶
type DialOptions struct {
// Host is the target hostname.
Host string
// Dialer is the underlying dialer to use.
Dialer xnet.Dialer
}
DialOptions holds the runtime parameters for the Dial operation.
type Dialer ¶
type Dialer interface {
// Init initializes the dialer with metadata.
Init(metadata.Metadata) error
// Dial connects to the proxy server at the given address.
Dial(ctx context.Context, addr string, opts ...DialOption) (net.Conn, error)
}
Dialer is responsible for dialing to a proxy server. It establishes the raw network connection to the next hop in the proxy chain. After the connection is established, a connector handles the application-level protocol negotiation with the destination.
type HandshakeOption ¶
type HandshakeOption func(opts *HandshakeOptions)
HandshakeOption is a functional option for configuring HandshakeOptions.
func AddrHandshakeOption ¶
func AddrHandshakeOption(addr string) HandshakeOption
AddrHandshakeOption sets the proxy server address for the handshake.
type HandshakeOptions ¶
type HandshakeOptions struct {
// Addr is the address of the proxy server.
Addr string
}
HandshakeOptions holds the runtime parameters for the Handshake operation.
type Handshaker ¶
type Handshaker interface {
Handshake(ctx context.Context, conn net.Conn, opts ...HandshakeOption) (net.Conn, error)
}
Handshaker performs a transport-level handshake on a connection, such as TLS or other transport-layer protocol negotiation. This runs after Dial and before any application-level handshake (see connector.Handshaker).
type Multiplexer ¶
type Multiplexer interface {
Multiplex() bool
}
Multiplexer reports whether the dialed connection supports multiplexing multiple logical streams over a single physical connection.
type Option ¶
type Option func(opts *Options)
Option is a functional option for configuring Options.
func AuthOption ¶
AuthOption sets the authentication credentials.
func ProxyProtocolOption ¶
ProxyProtocolOption sets the proxy protocol version.
func TLSConfigOption ¶
TLSConfigOption sets the TLS configuration.
type Options ¶
type Options struct {
// Auth is the authentication credentials for the dialer.
Auth *url.Userinfo
// TLSConfig is the TLS configuration for the dialer's outgoing connections.
TLSConfig *tls.Config
// Logger is the logger for dialer operations.
Logger logger.Logger
// ProxyProtocol is the proxy protocol version (0 = disabled).
ProxyProtocol int
}
Options holds the initialization parameters for a Dialer.