Versions in this module Expand all Collapse all v1 v1.0.2 Apr 25, 2024 v1.0.1 Apr 24, 2024 Changes in this version + var ErrShortPacket = errors.New("short packet") + func Pack(dst, plaintext []byte, s Cipher) ([]byte, error) + func Unpack(dst, pkt []byte, s Cipher) ([]byte, error) + type Cipher interface + Decrypter func(iv []byte) cipher.Stream + Encrypter func(iv []byte) cipher.Stream + IVSize func() int + func AESCFB(key []byte) (Cipher, error) + func AESCTR(key []byte) (Cipher, error) + func ChaCha20(key []byte) (Cipher, error) + func Chacha20IETF(key []byte) (Cipher, error) + func RC4MD5(key []byte) (Cipher, error) + func Xchacha20(key []byte) (Cipher, error) + type Conn struct + func NewConn(c net.Conn, ciph Cipher) *Conn + func (c *Conn) ObtainReadIV() ([]byte, error) + func (c *Conn) ObtainWriteIV() ([]byte, error) + 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 N.EnhancePacketConn, ciph Cipher) *PacketConn + func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error) + func (c *PacketConn) WaitReadFrom() (data []byte, put func(), addr net.Addr, err error) + func (c *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error) + type Reader struct + func NewReader(r io.Reader, s cipher.Stream) *Reader + func (r *Reader) Read(p []byte) (n int, err error) + func (r *Reader) WriteTo(w io.Writer) (n int64, err error) + type Writer struct + func NewWriter(w io.Writer, s cipher.Stream) *Writer + func (w *Writer) ReadFrom(r io.Reader) (n int64, err error) + func (w *Writer) Write(p []byte) (n int, err error)