Documentation
¶
Overview ¶
Package config loads, validates, and (in future phases) hot-reloads snix configuration. A config is a list of named Profiles; exactly one is "active" at a time but switching is instantaneous and does not drop existing flows.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// Version pins the schema so we can evolve without silent breakage.
Version int `yaml:"version"`
// Active names the Profile to run on startup. If empty, the first
// profile is used.
Active string `yaml:"active,omitempty"`
// Profiles is the set of named server bundles.
Profiles []Profile `yaml:"profiles"`
// Log controls output verbosity.
Log LogConfig `yaml:"log,omitempty"`
}
Config is the top-level YAML document.
func Parse ¶
Parse validates a YAML document in memory. Exported so the TUI can validate as the user types.
type ConnectConfig ¶
type ConnectConfig struct {
// Host is a DNS name or IP literal. If Host resolves to multiple A/AAAA
// records, FallbackIPs is merged in.
Host string `yaml:"host"`
// Port on the upstream (typically 443).
Port uint16 `yaml:"port"`
// FallbackIPs are additional IPs to try if Host fails or is blocked.
FallbackIPs []string `yaml:"fallback_ips,omitempty"`
}
ConnectConfig describes the upstream server.
type HealthConfig ¶
type HealthConfig struct {
// Interval between probes. Default 30s.
Interval time.Duration `yaml:"interval,omitempty"`
// AutoFailover rotates to the next FallbackIP on sustained failure.
AutoFailover bool `yaml:"auto_failover,omitempty"`
}
HealthConfig tunes the background health monitor.
type LogConfig ¶
type LogConfig struct {
// Level is "debug", "info", "warn", or "error".
Level string `yaml:"level,omitempty"`
// File, if set, writes logs there in addition to stderr.
File string `yaml:"file,omitempty"`
}
LogConfig configures the logger.
type Profile ¶
type Profile struct {
// Name uniquely identifies this profile.
Name string `yaml:"name"`
// Listen is the local address the proxy binds to (e.g. "127.0.0.1:40443").
Listen string `yaml:"listen"`
// Connect is the upstream server the relay talks to.
Connect ConnectConfig `yaml:"connect"`
// Spoof configures the DPI bypass applied during the handshake.
Spoof SpoofConfig `yaml:"spoof"`
// Health configures passive failover behaviour.
Health HealthConfig `yaml:"health,omitempty"`
}
Profile describes one bypass target plus the spoofing strategy to use.
func (*Profile) EffectiveSNIPool ¶
EffectiveSNIPool returns the spoof SNI candidates with SNI promoted to a single-entry pool when SNIPool is empty.
type SpoofConfig ¶
type SpoofConfig struct {
// Strategy selects the bypass algorithm; see core/bypass for names.
// If StrategyRotation is non-empty this is the fallback used only when
// rotation is disabled.
Strategy bypass.Name `yaml:"strategy"`
// StrategyRotation, if non-empty, randomizes the strategy per flow.
// Typical: ["wrong_seq", "wrong_checksum"].
StrategyRotation []bypass.Name `yaml:"strategy_rotation,omitempty"`
// SNIPool is the list of fake SNI values to rotate through. If empty,
// SNI is required instead.
SNIPool []string `yaml:"sni_pool,omitempty"`
// SNI is a single fake SNI; only used if SNIPool is empty.
SNI string `yaml:"sni,omitempty"`
// SNISelection is "random" (default) or "round_robin".
SNISelection string `yaml:"sni_selection,omitempty"`
// RandomizeTiming jitters the inject delay; MinDelay/MaxDelay bound it.
RandomizeTiming bool `yaml:"randomize_timing,omitempty"`
MinDelay time.Duration `yaml:"min_delay,omitempty"`
MaxDelay time.Duration `yaml:"max_delay,omitempty"`
// RandomizePadding varies the ClientHello size; the fake packet gets
// [MinExtraPad, MaxExtraPad] bytes of additional padding on top of 517.
RandomizePadding bool `yaml:"randomize_padding,omitempty"`
MinExtraPad int `yaml:"min_extra_pad,omitempty"`
MaxExtraPad int `yaml:"max_extra_pad,omitempty"`
// IPIDDeltaRange is the upper bound on the IP ID delta applied to the
// injected packet. 1 (default) matches upstream; higher breaks the
// predictable +1 pattern.
IPIDDeltaRange int `yaml:"ip_id_delta_range,omitempty"`
}
SpoofConfig configures the DPI bypass strategy.