Documentation
¶
Overview ¶
Package config handles TOML configuration parsing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildFullSecret ¶
BuildFullSecret builds the full secret string: ee + key + hex(host)
func GenerateKey ¶
GenerateKey generates a new random 16-byte key (returned as 32 hex chars).
Types ¶
type Config ¶
type Config struct {
// Top-level options (can also be set in [general] section)
BindTo string `toml:"bind-to"`
LogLevel string `toml:"log-level"`
ProxyProtocol bool `toml:"proxy-protocol"`
MaxConnectionsPerIP int `toml:"max-connections-per-ip"`
Secrets map[string]string `toml:"secrets"` // name = "secret"
General GeneralConfig `toml:"general"`
TLSFronting TLSFrontingConfig `toml:"tls-fronting"`
Performance PerformanceConfig `toml:"performance"`
Upstream UpstreamConfig `toml:"upstream"`
}
Config is the TOML configuration structure.
type GeneralConfig ¶ added in v0.1.4
type GeneralConfig struct {
BindTo string `toml:"bind-to"`
LogLevel string `toml:"log-level"` // trace, debug, info, warn, error
ProxyProtocol bool `toml:"proxy-protocol"` // Accept incoming PROXY protocol
MaxConnectionsPerIP int `toml:"max-connections-per-ip"` // Per IP+secret, 0 = unlimited
}
GeneralConfig contains general server settings.
type PerformanceConfig ¶
type PerformanceConfig struct {
TCPBufferKB int `toml:"tcp-buffer-kb"`
NumEventLoops int `toml:"num-event-loops"` // gnet event loops (0 = auto, uses all cores)
PreferIP string `toml:"prefer-ip"`
IdleTimeout Duration `toml:"idle-timeout"`
}
PerformanceConfig configures performance settings.
type TLSFrontingConfig ¶
type TLSFrontingConfig struct {
MaskHost string `toml:"mask-host"` // Domain to mimic (SNI validation, proxy links)
MaskPort int `toml:"mask-port"` // Default port (default: 443)
// Certificate fetching - where to connect to get real TLS cert
// Defaults to mask-host:mask-port if not set
// Useful when cert must be fetched from local nginx bypassing front proxy
CertHost string `toml:"cert-host"`
CertPort int `toml:"cert-port"`
// Splice target - where to forward unrecognized clients
// Defaults to mask-host:mask-port if not set
SpliceHost string `toml:"splice-host"`
SplicePort int `toml:"splice-port"`
SpliceProxyProtocol int `toml:"splice-proxy-protocol"` // 0=off, 1=v1, 2=v2
}
TLSFrontingConfig configures TLS fronting.
type UpstreamConfig ¶ added in v0.1.3
type UpstreamConfig struct {
Socks5 string `toml:"socks5"` // SOCKS5 proxy address (e.g., "127.0.0.1:1080")
}
UpstreamConfig configures upstream (DC) connection settings.
Click to show internal directories.
Click to hide internal directories.