Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrShortPacket = errors.New("short packet")
ErrShortPacket means that the packet is too short for a valid encrypted packet.
View Source
var ErrZeroChunk = errors.New("zero chunk")
Functions ¶
Types ¶
type Cipher ¶
type Cipher interface {
KeySize() int
SaltSize() int
Encrypter(salt []byte) (cipher.AEAD, error)
Decrypter(salt []byte) (cipher.AEAD, error)
}
func AESGCM ¶
AESGCM creates a new Cipher with a pre-shared key. len(psk) must be one of 16, 24, or 32 to select AES-128/196/256-GCM.
func Chacha20Poly1305 ¶
Chacha20Poly1305 creates a new Cipher with a pre-shared key. len(psk) must be 32.
func XChacha20Poly1305 ¶
XChacha20Poly1305 creates a new Cipher with a pre-shared key. len(psk) must be 32.
type KeySizeError ¶
type KeySizeError int
func (KeySizeError) Error ¶
func (e KeySizeError) Error() string
type PacketConn ¶
type PacketConn struct {
net.PacketConn
Cipher
}
func NewPacketConn ¶
func NewPacketConn(c net.PacketConn, ciph Cipher) *PacketConn
NewPacketConn wraps a net.PacketConn with cipher
type Reader ¶
Click to show internal directories.
Click to hide internal directories.