Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPSKTooShort = fmt.Errorf("PSK must be at least %d bytes", smPSKMinLen)
Functions ¶
func WrapPacketConn ¶
func WrapPacketConn(conn net.PacketConn, obfs Obfuscator) net.PacketConn
WrapPacketConn enables obfuscation on a net.PacketConn. The obfuscation is transparent to the caller - the n bytes returned by ReadFrom and WriteTo are the number of original bytes, not after obfuscation/deobfuscation.
Types ¶
type Obfuscator ¶
Obfuscator is the interface that wraps the Obfuscate and Deobfuscate methods. Both methods return the number of bytes written to out. If a packet is not valid, the methods should return 0.
func NewObfuscatorFromConfig ¶ added in v0.0.1
func NewObfuscatorFromConfig(cfg ObfuscatorConfig) (Obfuscator, error)
NewObfuscatorFromConfig is a factory function that creates and returns an Obfuscator interface instance based on the provided configuration. It centralizes the instantiation logic for different obfuscation protocols.
type ObfuscatorConfig ¶ added in v0.0.1
type ObfuscatorConfig struct {
Type string `mapstructure:"type"` // Type of the obfuscator (e.g., "salamander", "scramble", "chameleon", "stealthflow", "quantumshuffle")
Password string `mapstructure:"password"` // Pre-shared key/password used by the obfuscator
}
ObfuscatorConfig defines the common configuration structure for all obfuscators. This allows for unified configuration parsing.
type SalamanderObfuscator ¶
type SalamanderObfuscator struct {
PSK []byte
RandSrc *rand.Rand
// contains filtered or unexported fields
}
SalamanderObfuscator is an obfuscator that obfuscates each packet with the BLAKE2b-256 hash of a pre-shared key combined with a random salt. Packet format: [8-byte salt][payload]
func NewSalamanderObfuscator ¶
func NewSalamanderObfuscator(psk []byte) (*SalamanderObfuscator, error)
func (*SalamanderObfuscator) Deobfuscate ¶
func (o *SalamanderObfuscator) Deobfuscate(in, out []byte) int
func (*SalamanderObfuscator) Obfuscate ¶
func (o *SalamanderObfuscator) Obfuscate(in, out []byte) int