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 { N.EnhancePacketConn Cipher }
func NewPacketConn ¶
func NewPacketConn(c N.EnhancePacketConn, ciph Cipher) *PacketConn
NewPacketConn wraps an N.EnhancePacketConn with cipher
func (*PacketConn) WaitReadFrom ¶
func (c *PacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr, err error)
type Reader ¶
Click to show internal directories.
Click to hide internal directories.