Versions in this module Expand all Collapse all v1 v1.0.1 Mar 14, 2024 v1.0.0 Mar 14, 2024 Changes in this version + var ErrShortPacket = errors.New("short packet") + var ErrZeroChunk = errors.New("zero chunk") + func Pack(dst, plaintext []byte, ciph Cipher) ([]byte, error) + func Unpack(dst, pkt []byte, ciph Cipher) ([]byte, error) + type Cipher interface + Decrypter func(salt []byte) (cipher.AEAD, error) + Encrypter func(salt []byte) (cipher.AEAD, error) + KeySize func() int + SaltSize func() int + func AESGCM(psk []byte) (Cipher, error) + func Chacha20Poly1305(psk []byte) (Cipher, error) + func XChacha20Poly1305(psk []byte) (Cipher, error) + type Conn struct + func NewConn(c net.Conn, ciph Cipher) *Conn + func (c *Conn) Read(b []byte) (int, error) + func (c *Conn) ReadFrom(r io.Reader) (int64, error) + func (c *Conn) Write(b []byte) (int, error) + func (c *Conn) WriteTo(w io.Writer) (int64, error) + type KeySizeError int + func (e KeySizeError) Error() string + type PacketConn struct + func NewPacketConn(c net.PacketConn, ciph Cipher) *PacketConn + func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) + func (c *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error) + type Reader struct + func NewReader(r io.Reader, aead cipher.AEAD) *Reader + func (r *Reader) Read(p []byte) (int, error) + func (r *Reader) WriteTo(w io.Writer) (n int64, err error) + type Writer struct + func NewWriter(w io.Writer, aead cipher.AEAD) *Writer + func (w *Writer) ReadFrom(r io.Reader) (n int64, err error) + func (w *Writer) Write(p []byte) (n int, err error)