dialer

package
v0.72.3 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConnectionTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

func IsDatagramSized added in v0.72.3

func IsDatagramSized(d DialeFn) bool

IsDatagramSized reports whether d produces datagram-sized connections.

Types

type DatagramSized added in v0.72.3

type DatagramSized interface {
	DatagramSized()
}

DatagramSized is implemented by dialers whose connections carry each write in a single datagram, so a write can be rejected when it exceeds the path's datagram budget (e.g. QUIC). Transports without this capability (e.g. WebSocket over TCP) impose no per-write size limit, so the relay client can fall back to them when a datagram-sized transport rejects a write as too large. The capability is advertised per dialer rather than hardcoded, so a new transport only needs to declare whether it is datagram-sized.

type DialeFn

type DialeFn interface {
	// Dial connects to address. serverName, when non-empty, overrides the TLS
	// ServerName used for SNI/cert validation. Empty means derive from address.
	Dial(ctx context.Context, address, serverName string) (net.Conn, error)
	Protocol() string
}

type RaceDial

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

func NewRaceDial

func NewRaceDial(log *log.Entry, connectionTimeout time.Duration, serverURL string, dialerFns ...DialeFn) *RaceDial

func (*RaceDial) Dial

func (r *RaceDial) Dial(ctx context.Context) (net.Conn, error)

func (*RaceDial) WithSequential added in v0.72.3

func (r *RaceDial) WithSequential() *RaceDial

WithSequential makes Dial try the dialers in order, falling back to the next only when one fails to connect, instead of racing them concurrently.

Mutates the receiver and is not safe for concurrent reconfiguration; a RaceDial is intended to be constructed per dial and discarded.

func (*RaceDial) WithServerName added in v0.70.5

func (r *RaceDial) WithServerName(serverName string) *RaceDial

WithServerName sets a TLS SNI/cert validation override. Used when serverURL contains an IP literal but the cert is issued for a different hostname.

Mutates the receiver and is not safe for concurrent reconfiguration; a RaceDial is intended to be constructed per dial and discarded.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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