client

package
v0.0.0-...-b617006 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(config *Config) (Client, *HandshakeInfo, error)

Types

type BandwidthConfig

type BandwidthConfig struct {
	MaxTx uint64
	MaxRx uint64
}

BandwidthConfig describes the maximum bandwidth that the server can use, in bytes per second.

type Client

type Client interface {
	TCP(addr string) (netproxy.Conn, error)
	UDP(addr string) (netproxy.Conn, error)
	Close() error
}

func NewReconnectableClient

func NewReconnectableClient(configFunc func() (*Config, error), connectedFunc func(Client, *HandshakeInfo, int), lazy bool) (Client, error)

NewReconnectableClient creates a reconnectable client. If lazy is true, the client will not connect until the first call to TCP() or UDP(). We use a function for config mainly to delay config evaluation (which involves DNS resolution) until the actual connection attempt.

type Config

type Config struct {
	ConnFactory     ConnFactory
	ServerAddr      net.Addr
	Auth            string
	TLSConfig       TLSConfig
	QUICConfig      QUICConfig
	BandwidthConfig BandwidthConfig
	FastOpen        bool
	// contains filtered or unexported fields
}

type ConnFactory

type ConnFactory interface {
	New(net.Addr) (net.PacketConn, error)
}

type HandshakeInfo

type HandshakeInfo struct {
	UDPEnabled bool
	Tx         uint64 // 0 if using BBR
}

type QUICConfig

type QUICConfig struct {
	InitialStreamReceiveWindow     uint64
	MaxStreamReceiveWindow         uint64
	InitialConnectionReceiveWindow uint64
	MaxConnectionReceiveWindow     uint64
	MaxIdleTimeout                 time.Duration
	KeepAlivePeriod                time.Duration
	DisablePathMTUDiscovery        bool // The server may still override this to true on unsupported platforms.
}

QUICConfig contains the QUIC configuration fields that we want to expose to the user.

type TLSConfig

type TLSConfig struct {
	ServerName            string
	InsecureSkipVerify    bool
	VerifyPeerCertificate func(rawCerts [][]byte, verifiedChains [][]*x509.Certificate) error
	RootCAs               *x509.CertPool
}

TLSConfig contains the TLS configuration fields that we want to expose to the user.

Jump to

Keyboard shortcuts

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