obfs

package
v0.0.0-...-0cae4bf Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: GPL-3.0 Imports: 7 Imported by: 1

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.

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