shadowaead_2022

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: GPL-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderTypeClient              = 0
	HeaderTypeServer              = 1
	MaxPaddingLength              = 900
	PacketNonceSize               = 24
	RequestHeaderFixedChunkLength = 1 + 8 + 2
	PacketMinimalHeaderSize       = 30
)

Variables

View Source
var (
	ErrNoEIH                 = E.New("Shadowsocks 2022 EIH support only available in AES ciphers")
	ErrBadHeaderType         = E.New("bad header type")
	ErrBadTimestamp          = E.New("bad timestamp")
	ErrBadRequestSalt        = E.New("bad request salt")
	ErrSaltNotUnique         = E.New("salt not unique")
	ErrBadClientSessionId    = E.New("bad client session id")
	ErrPacketIdNotUnique     = E.New("packet id not unique")
	ErrTooManyServerSessions = E.New("server session changed more than once during the last minute")
)
View Source
var MethodList = []string{
	"2022-blake3-aes-128-gcm",
	"2022-blake3-aes-256-gcm",
	"2022-blake3-chacha20-poly1305",
}

Functions

func Blake3KeyedHash

func Blake3KeyedHash(reader io.Reader) io.Reader

func Key

func Key(key []byte, keyLength int) []byte

func NewMethod

func NewMethod(ctx context.Context, methodName string, options C.MethodOptions) (C.Method, error)

func SessionKey

func SessionKey(psk []byte, salt []byte, keyLength int) []byte

Types

type Method

type Method struct {
	// contains filtered or unexported fields
}

func (*Method) DialConn

func (m *Method) DialConn(conn net.Conn, destination M.Socksaddr) (net.Conn, error)

func (*Method) DialEarlyConn

func (m *Method) DialEarlyConn(conn net.Conn, destination M.Socksaddr) net.Conn

func (*Method) DialPacketConn

func (m *Method) DialPacketConn(conn net.Conn) N.NetPacketConn

type SlidingWindow

type SlidingWindow struct {
	// contains filtered or unexported fields
}

SlidingWindow maintains a sliding window of uint64 counters.

func (*SlidingWindow) Add

func (f *SlidingWindow) Add(counter uint64)

Add adds counter to the sliding window without checking if the counter is valid. Call Check beforehand to make sure the counter is valid.

func (*SlidingWindow) Check

func (f *SlidingWindow) Check(counter uint64) bool

Check checks whether counter can be accepted by the sliding window filter.

func (*SlidingWindow) Reset

func (f *SlidingWindow) Reset()

Reset resets the filter to its initial state.

Jump to

Keyboard shortcuts

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