Documentation
¶
Overview ¶
Package fingerprint centralizes the anti-DPI-fingerprinting knobs: timing jitter, size padding, IP ID deltas, SNI selection, and per-connection strategy rotation.
Each individual knob is small; the cumulative effect is that an on-path DPI cannot pattern-match snix traffic by any single invariant (fixed 517-byte packet, fixed 1 ms delay, fixed +1 IP ID, single SNI).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Knobs ¶
type Knobs struct {
// Timing: if RandomizeTiming, each injection waits a uniform delay in
// [MinDelay, MaxDelay]. Otherwise the fixed InjectDelay is used.
RandomizeTiming bool
MinDelay time.Duration
MaxDelay time.Duration
// Padding: if RandomizePadding, an extra [MinExtraPad, MaxExtraPad]
// bytes are appended to the fake ClientHello so its size is not
// invariantly 517. Upstream used fixed 517.
RandomizePadding bool
MinExtraPad int
MaxExtraPad int
// IPIDDeltaRange sets the maximum IP ID delta applied to the fake
// packet. If zero, delta is fixed at 1 (upstream behaviour).
// Actual delta is uniform in [1, IPIDDeltaRange].
IPIDDeltaRange int
// StrategyRotation, if non-empty, overrides a single fixed Strategy
// with a per-flow random choice. Each flow independently picks one.
// Typical value: ["wrong_seq", "wrong_checksum"].
StrategyRotation []bypass.Name
// SNISelection selects one SNI per new flow. "round_robin" preserves
// upstream-style deterministic rotation; "random" picks uniformly.
// Default: "random".
SNISelection string
}
Knobs configures the randomizer. Zero values mean "use upstream defaults" (matches fixed-shape upstream behaviour).
type Randomizer ¶
type Randomizer struct {
// contains filtered or unexported fields
}
Randomizer owns the cryptographic RNG and exposes per-flow picks.
func New ¶
func New(k Knobs) *Randomizer
New returns a Randomizer with the given knobs; normalizes defaults.
func (*Randomizer) Delay ¶
func (r *Randomizer) Delay() time.Duration
Delay returns the per-injection delay to wait before emitting the fake packet.
func (*Randomizer) ExtraPad ¶
func (r *Randomizer) ExtraPad() int
ExtraPad returns the number of bytes to append to the fake ClientHello.
func (*Randomizer) IPIDDelta ¶
func (r *Randomizer) IPIDDelta() uint16
IPIDDelta returns a uint16 delta in [1, IPIDDeltaRange].
func (*Randomizer) PickSNI ¶
func (r *Randomizer) PickSNI(pool []string) string
PickSNI returns one SNI from pool according to SNISelection. Returns "" if pool is empty.
func (*Randomizer) PickStrategy ¶
func (r *Randomizer) PickStrategy(fallback bypass.Name) bypass.Name
PickStrategy returns a strategy name from StrategyRotation or the fallback.