shadowstream

package
v0.0.0-...-40f201c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrShortPacket = errors.New("short packet")

Functions

func NewConn

func NewConn(c net.Conn, ciph Cipher) net.Conn

func NewPacketConn

func NewPacketConn(c net.PacketConn, ciph Cipher) net.PacketConn

func NewReader

func NewReader(r io.Reader, s cipher.Stream) io.Reader

func NewWriter

func NewWriter(w io.Writer, s cipher.Stream) io.Writer

func Pack

func Pack(dst, plaintext []byte, s Cipher) ([]byte, error)

func Unpack

func Unpack(dst, pkt []byte, s Cipher) ([]byte, error)

Types

type Cipher

type Cipher interface {
	IVSize() int
	Encrypter(iv []byte) cipher.Stream
	Decrypter(iv []byte) cipher.Stream
}

func AESCFB

func AESCFB(key []byte) (Cipher, error)

func AESCTR

func AESCTR(key []byte) (Cipher, error)

func Chacha20

func Chacha20(key []byte) (Cipher, error)

func Chacha20IETF

func Chacha20IETF(key []byte) (Cipher, error)

func RC4MD5

func RC4MD5(key []byte) (Cipher, error)

func Xchacha20

func Xchacha20(key []byte) (Cipher, error)

type Conn

type Conn struct {
	net.Conn
	Cipher
	// contains filtered or unexported fields
}

func (*Conn) ObtainRIV

func (c *Conn) ObtainRIV() ([]byte, error)

func (*Conn) ObtainWIV

func (c *Conn) ObtainWIV() ([]byte, error)

func (*Conn) Read

func (c *Conn) Read(b []byte) (int, error)

func (*Conn) ReadFrom

func (c *Conn) ReadFrom(r io.Reader) (int64, error)

func (*Conn) Write

func (c *Conn) Write(b []byte) (int, error)

func (*Conn) WriteTo

func (c *Conn) WriteTo(w io.Writer) (int64, error)

type KeySizeError

type KeySizeError int

func (KeySizeError) Error

func (e KeySizeError) Error() string

type PacketConn

type PacketConn struct {
	net.PacketConn
	Cipher

	sync.Mutex
	// contains filtered or unexported fields
}

func (*PacketConn) ReadFrom

func (c *PacketConn) ReadFrom(b []byte) (int, net.Addr, error)

func (*PacketConn) WriteTo

func (c *PacketConn) WriteTo(b []byte, addr net.Addr) (int, error)

type Reader

type Reader struct {
	io.Reader
	cipher.Stream
	// contains filtered or unexported fields
}

func (*Reader) Read

func (r *Reader) Read(b []byte) (int, error)

func (*Reader) WriteTo

func (r *Reader) WriteTo(w io.Writer) (n int64, err error)

type Writer

type Writer struct {
	io.Writer
	cipher.Stream
	// contains filtered or unexported fields
}

func (*Writer) ReadFrom

func (w *Writer) ReadFrom(r io.Reader) (n int64, err error)

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL