obfs

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

type Obfuscator interface {
	Obfuscate(in, out []byte) int
	Deobfuscate(in, out []byte) int
}

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL