dialer

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 7 Imported by: 1 module, 29 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func AuthOption(auth *url.Userinfo) Option

AuthOption sets the authentication credentials.

func LoggerOption

func LoggerOption(logger logger.Logger) Option

LoggerOption sets the logger.

func ProxyProtocolOption

func ProxyProtocolOption(ppv int) Option

ProxyProtocolOption sets the proxy protocol version.

func TLSConfigOption

func TLSConfigOption(tlsConfig *tls.Config) Option

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.

Jump to

Keyboard shortcuts

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