Documentation ¶
Index ¶
- Variables
- func NewConn(c net.Conn, ciph Cipher) net.Conn
- func NewPacketConn(c net.PacketConn, ciph Cipher) net.PacketConn
- func NewReader(r io.Reader, s cipher.Stream) io.Reader
- func NewWriter(w io.Writer, s cipher.Stream) io.Writer
- func Pack(dst, plaintext []byte, s Cipher) ([]byte, error)
- func Unpack(dst, pkt []byte, s Cipher) ([]byte, error)
- type Cipher
- type KeySizeError
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrShortPacket = errors.New("short packet")
ErrShortPacket means the packet is too short to be a valid encrypted packet.
Functions ¶
func NewPacketConn ¶
func NewPacketConn(c net.PacketConn, ciph Cipher) net.PacketConn
NewPacketConn wraps a net.PacketConn with stream cipher encryption/decryption.
Types ¶
type Cipher ¶
type Cipher interface { IVSize() int Encrypter(iv []byte) cipher.Stream Decrypter(iv []byte) cipher.Stream }
Cipher generates a pair of stream ciphers for encryption and decryption.
func Chacha20IETF ¶
Chacha20IETF returns a Chacha20IETF cipher.
type KeySizeError ¶
type KeySizeError int
KeySizeError is an error about the key size.
func (KeySizeError) Error ¶
func (e KeySizeError) Error() string
Click to show internal directories.
Click to hide internal directories.