Documentation
¶
Index ¶
- Variables
- type Conn
- type HostPool
- func (p *HostPool) Close()
- func (p *HostPool) CloseIdle()
- func (p *HostPool) GetConn(ctx context.Context) (*Conn, error)
- func (p *HostPool) SetECHConfig(echConfig []byte)
- func (p *HostPool) SetECHConfigDomain(domain string)
- func (p *HostPool) SetLocalAddr(addr string)
- func (p *HostPool) SetMaxConns(max int)
- func (p *HostPool) Stats() (total int, healthy int, totalRequests int64)
- type Manager
- func (m *Manager) Close()
- func (m *Manager) CloseAllPools()
- func (m *Manager) GetConn(ctx context.Context, host, port string) (*Conn, error)
- func (m *Manager) GetDNSCache() *dns.Cache
- func (m *Manager) GetPool(host, port string) (*HostPool, error)
- func (m *Manager) GetProxy() string
- func (m *Manager) GetSessionCache() utls.ClientSessionCache
- func (m *Manager) SetConnectTo(requestHost, connectHost string)
- func (m *Manager) SetECHConfig(echConfig []byte)
- func (m *Manager) SetECHConfigDomain(domain string)
- func (m *Manager) SetMaxConnsPerHost(max int)
- func (m *Manager) SetPreset(preset *fingerprint.Preset)
- func (m *Manager) SetProxy(proxyURL string)
- func (m *Manager) SetSessionCache(cache utls.ClientSessionCache)
- func (m *Manager) Stats() map[string]struct{ ... }
- type QUICConn
- type QUICHostPool
- func (p *QUICHostPool) Close()
- func (p *QUICHostPool) CloseConnections()
- func (p *QUICHostPool) CloseIdle()
- func (p *QUICHostPool) GetConn(ctx context.Context) (*QUICConn, error)
- func (p *QUICHostPool) SetLocalAddr(addr string)
- func (p *QUICHostPool) SetMaxConns(max int)
- func (p *QUICHostPool) Stats() (total int, healthy int, totalRequests int64)
- type QUICManager
- func (m *QUICManager) Close()
- func (m *QUICManager) CloseAllConnections()
- func (m *QUICManager) CloseAllPools()
- func (m *QUICManager) GetConn(ctx context.Context, host, port string) (*QUICConn, error)
- func (m *QUICManager) GetPool(host, port string) (*QUICHostPool, error)
- func (m *QUICManager) SetConnectTo(requestHost, connectHost string)
- func (m *QUICManager) SetDisableECH(disable bool)
- func (m *QUICManager) SetECHConfig(echConfig []byte)
- func (m *QUICManager) SetECHConfigDomain(domain string)
- func (m *QUICManager) SetInsecureSkipVerify(skip bool)
- func (m *QUICManager) SetLocalAddr(addr string)
- func (m *QUICManager) SetMaxConnsPerHost(max int)
- func (m *QUICManager) Stats() map[string]struct{ ... }
Constants ¶
This section is empty.
Variables ¶
var ( ErrPoolClosed = errors.New("connection pool is closed") ErrNoConnections = errors.New("no available connections") )
Functions ¶
This section is empty.
Types ¶
type Conn ¶
type Conn struct {
Host string
RemoteAddr net.Addr
TLSConn *utls.UConn
HTTP2Conn *http2.ClientConn
CreatedAt time.Time
LastUsedAt time.Time
UseCount int64
// contains filtered or unexported fields
}
Conn represents a persistent connection
type HostPool ¶
type HostPool struct {
// contains filtered or unexported fields
}
HostPool manages connections to a single host
func NewHostPool ¶
NewHostPool creates a new pool for a specific host Note: This generates its own shuffled specs. For consistent session fingerprinting, use Manager.GetPool() instead which shares cached specs across all hosts.
func NewHostPoolWithConfig ¶
func NewHostPoolWithConfig(host, sniHost, port string, preset *fingerprint.Preset, dnsCache *dns.Cache, insecureSkipVerify bool, proxyURL string, cachedSpec, cachedPSKSpec *utls.ClientHelloSpec, shuffleSeed int64, sessionCache utls.ClientSessionCache) *HostPool
NewHostPoolWithConfig creates a pool with TLS and proxy configuration host is the connection host (for DNS resolution, may be connectTo target) sniHost is the TLS ServerName host (original request host, used for SNI) If sniHost is empty, host is used for both DNS and SNI
func (*HostPool) CloseIdle ¶
func (p *HostPool) CloseIdle()
CloseIdle closes connections that have been idle too long
func (*HostPool) SetECHConfig ¶ added in v1.5.3
SetECHConfig sets a custom ECH configuration for this pool
func (*HostPool) SetECHConfigDomain ¶ added in v1.5.3
SetECHConfigDomain sets a domain to fetch ECH config from
func (*HostPool) SetLocalAddr ¶ added in v1.6.0
SetLocalAddr sets the local IP address for outgoing connections
func (*HostPool) SetMaxConns ¶
SetMaxConns sets the maximum connections for this pool (0 = unlimited)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager manages connection pools for multiple hosts
func NewManager ¶
func NewManager(preset *fingerprint.Preset) *Manager
NewManager creates a new connection pool manager
func NewManagerWithProxy ¶
func NewManagerWithProxy(preset *fingerprint.Preset, proxyURL string, insecureSkipVerify bool) *Manager
NewManagerWithProxy creates a manager with proxy support
func NewManagerWithTLSConfig ¶
func NewManagerWithTLSConfig(preset *fingerprint.Preset, insecureSkipVerify bool) *Manager
NewManagerWithTLSConfig creates a manager with TLS configuration
func (*Manager) CloseAllPools ¶ added in v1.5.8
func (m *Manager) CloseAllPools()
CloseAllPools closes all connection pools and clears session cache This is used when switching proxies - old connections are invalid for new proxy route
func (*Manager) GetDNSCache ¶
GetDNSCache returns the DNS cache
func (*Manager) GetSessionCache ¶ added in v1.5.10
func (m *Manager) GetSessionCache() utls.ClientSessionCache
GetSessionCache returns the shared TLS session cache
func (*Manager) SetConnectTo ¶ added in v1.5.2
SetConnectTo sets a host mapping for domain fronting
func (*Manager) SetECHConfig ¶ added in v1.5.2
SetECHConfig sets a custom ECH configuration
func (*Manager) SetECHConfigDomain ¶ added in v1.5.2
SetECHConfigDomain sets a domain to fetch ECH config from
func (*Manager) SetMaxConnsPerHost ¶
SetMaxConnsPerHost sets the max connections per host for new pools (0 = unlimited)
func (*Manager) SetPreset ¶
func (m *Manager) SetPreset(preset *fingerprint.Preset)
SetPreset changes the fingerprint preset for new connections
func (*Manager) SetProxy ¶ added in v1.5.8
SetProxy changes the proxy URL and closes all existing connections TLS sessions from old proxy route are invalid, so we clear everything
func (*Manager) SetSessionCache ¶ added in v1.5.10
func (m *Manager) SetSessionCache(cache utls.ClientSessionCache)
SetSessionCache sets the shared TLS session cache for all pools This allows session persistence to work across Save/Load
type QUICConn ¶
type QUICConn struct {
Host string
RemoteAddr net.Addr
QUICConn *quic.Conn
HTTP3RT *http3.Transport
CreatedAt time.Time
LastUsedAt time.Time
UseCount int64
// contains filtered or unexported fields
}
QUICConn represents a persistent QUIC connection
type QUICHostPool ¶
type QUICHostPool struct {
// contains filtered or unexported fields
}
QUICHostPool manages QUIC connections to a single host
func NewQUICHostPool ¶
func NewQUICHostPool(host, port string, preset *fingerprint.Preset, dnsCache *dns.Cache) *QUICHostPool
NewQUICHostPool creates a new QUIC pool for a specific host
func NewQUICHostPoolWithCachedSpec ¶ added in v1.1.4
func NewQUICHostPoolWithCachedSpec(host, sniHost, port string, preset *fingerprint.Preset, dnsCache *dns.Cache, cachedSpec *utls.ClientHelloSpec, cachedPSKSpec *utls.ClientHelloSpec, shuffleSeed int64) *QUICHostPool
NewQUICHostPoolWithCachedSpec creates a QUIC pool with a pre-cached ClientHelloSpec and shuffle seed This ensures consistent TLS extension order and transport parameter order across all hosts in a session cachedSpec is used for initial connections, cachedPSKSpec is used when resuming sessions host is the connection host (for DNS), sniHost is the TLS ServerName (original request host) If sniHost is empty, host is used for both
func (*QUICHostPool) Close ¶
func (p *QUICHostPool) Close()
Close closes all connections in the pool
func (*QUICHostPool) CloseConnections ¶ added in v1.5.7
func (p *QUICHostPool) CloseConnections()
CloseConnections closes all connections but keeps the pool usable This allows testing session resumption by forcing new connections
func (*QUICHostPool) CloseIdle ¶
func (p *QUICHostPool) CloseIdle()
CloseIdle closes connections that have been idle too long
func (*QUICHostPool) GetConn ¶
func (p *QUICHostPool) GetConn(ctx context.Context) (*QUICConn, error)
GetConn returns an available QUIC connection or creates a new one
func (*QUICHostPool) SetLocalAddr ¶ added in v1.6.0
func (p *QUICHostPool) SetLocalAddr(addr string)
SetLocalAddr sets the local IP address for outgoing connections
func (*QUICHostPool) SetMaxConns ¶
func (p *QUICHostPool) SetMaxConns(max int)
SetMaxConns sets the maximum connections for this pool (0 = unlimited)
type QUICManager ¶
type QUICManager struct {
// contains filtered or unexported fields
}
QUICManager manages QUIC connection pools for multiple hosts
func NewQUICManager ¶
func NewQUICManager(preset *fingerprint.Preset, dnsCache *dns.Cache) *QUICManager
NewQUICManager creates a new QUIC connection pool manager
func (*QUICManager) Close ¶
func (m *QUICManager) Close()
Close shuts down the manager and all pools
func (*QUICManager) CloseAllConnections ¶ added in v1.5.7
func (m *QUICManager) CloseAllConnections()
CloseAllConnections closes all QUIC connections across all pools but keeps the pools usable with their session caches intact This is useful for testing session resumption
func (*QUICManager) CloseAllPools ¶ added in v1.5.8
func (m *QUICManager) CloseAllPools()
CloseAllPools closes all pools and removes them entirely This is used when switching proxies - old connections/sessions are invalid for new proxy route
func (*QUICManager) GetPool ¶
func (m *QUICManager) GetPool(host, port string) (*QUICHostPool, error)
GetPool returns a pool for the given host, creating one if needed
func (*QUICManager) SetConnectTo ¶ added in v1.5.2
func (m *QUICManager) SetConnectTo(requestHost, connectHost string)
SetConnectTo sets a host mapping for domain fronting
func (*QUICManager) SetDisableECH ¶ added in v1.5.8
func (m *QUICManager) SetDisableECH(disable bool)
SetDisableECH disables automatic ECH fetching Chrome doesn't always use ECH even when available from DNS
func (*QUICManager) SetECHConfig ¶ added in v1.5.2
func (m *QUICManager) SetECHConfig(echConfig []byte)
SetECHConfig sets a custom ECH configuration
func (*QUICManager) SetECHConfigDomain ¶ added in v1.5.2
func (m *QUICManager) SetECHConfigDomain(domain string)
SetECHConfigDomain sets a domain to fetch ECH config from
func (*QUICManager) SetInsecureSkipVerify ¶ added in v1.5.8
func (m *QUICManager) SetInsecureSkipVerify(skip bool)
SetInsecureSkipVerify sets whether to skip TLS certificate verification
func (*QUICManager) SetLocalAddr ¶ added in v1.6.0
func (m *QUICManager) SetLocalAddr(addr string)
SetLocalAddr sets the local IP address for outgoing connections
func (*QUICManager) SetMaxConnsPerHost ¶
func (m *QUICManager) SetMaxConnsPerHost(max int)
SetMaxConnsPerHost sets the max connections per host for new pools (0 = unlimited)