ssaead

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2023 License: MIT Imports: 11 Imported by: 0

README

Documentation

Index

Constants

View Source
const (
	MaxPacketSize          = 16*1024 - 1
	PacketLengthBufferSize = 2
)

https://shadowsocks.org/en/wiki/AEAD-Ciphers.html

View Source
const (
	// Overhead
	// crypto/cipher.gcmTagSize
	// golang.org/x/crypto/chacha20poly1305.Overhead
	Overhead = 16
)

Variables

View Source
var (
	ErrBadKey          = errors.New("bad key")
	ErrMissingPassword = errors.New("missing password")
)
View Source
var AeadCipher = aeadCipher

export AeadCipher function

View Source
var List = []string{
	"aes-128-gcm",
	"aes-192-gcm",
	"aes-256-gcm",
	"chacha20-ietf-poly1305",
	"xchacha20-ietf-poly1305",
}

Functions

func Kdf

func Kdf(key, iv, buf []byte) (int, error)

func Key

func Key(password []byte, keySize int) []byte

Types

type Method

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

func NewMethod

func NewMethod(method string, key []byte, password string) (*Method, error)

type Pair

type Pair[T any] struct {
	Name   string
	Method *Method
	Val    T
}

type Tester

type Tester[T any] struct {
	Lists []Pair[T]
}

func NewTester

func NewTester[T any]() *Tester[T]

func (*Tester[T]) Add

func (t *Tester[T]) Add(name, method, password string, val T) (err error)

func (*Tester[T]) Test

func (t *Tester[T]) Test(peeker peek.Peeker, cb func(name string, val T)) (bool, error)

func (*Tester[T]) TestPacket added in v0.1.33

func (t *Tester[T]) TestPacket(packet []byte) (bool, string, T)

Jump to

Keyboard shortcuts

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