core

package
v0.0.0-...-96f04ba Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2021 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPacketSize = 16384

MaxPacketSize is ...

Variables

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

ErrShortPacket is ...

View Source
var Pool = sync.Pool{
	New: func() interface{} {
		b := make([]byte, MaxPacketSize)

		return &b
	},
}

Pool is ...

Functions

func Get

func Get() (lazySlice, []byte)

Get is ...

func NewConn

func NewConn(conn net.Conn, cipher *Cipher) net.Conn

NewConn is ...

func NewPacketConn

func NewPacketConn(pc net.PacketConn, cipher *Cipher) net.PacketConn

NewPacketConn is ...

func Pack

func Pack(dst, pkt []byte, cipher *Cipher) ([]byte, error)

Pack is ...

func Put

func Put(s lazySlice)

Put is ...

func Unpack

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

Unpack is ...

Types

type Cipher

type Cipher struct {
	// KeySize is ...
	KeySize int
	// SaltSize is ...
	SaltSize int
	// NewAEAD is ...
	NewAEAD func([]byte) (cipher.AEAD, error)
}

Cipher is ...

func NewCipher

func NewCipher(method, password string) (*Cipher, error)

NewCipher is ...

func NewCipherFromKey

func NewCipherFromKey(method, password string, key []byte) (*Cipher, error)

NewCipherFromKey is ...

type CloseReader

type CloseReader interface {
	CloseRead() error
}

CloseReader is ...

type CloseWriter

type CloseWriter interface {
	CloseWrite() error
}

CloseWriter is ...

type Conn

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

Conn is ...

func (*Conn) CloseRead

func (c *Conn) CloseRead() error

func (*Conn) CloseWrite

func (c *Conn) CloseWrite() 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 PacketConn

type PacketConn struct {
	net.PacketConn
	Cipher *Cipher
}

PacketConn is ...

func (*PacketConn) ReadFrom

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

ReadFrom is ...

func (*PacketConn) WriteTo

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

WriteTo is ...

type Reader

type Reader struct {
	// Reader is ...
	Reader io.ReadCloser
	// Cipher is ...
	Cipher *Cipher
	// AEAD is ...
	AEAD cipher.AEAD
	// contains filtered or unexported fields
}

Reader is ...

func NewReader

func NewReader(r io.ReadCloser, cipher *Cipher) *Reader

NewReader is ...

func (*Reader) Close

func (r *Reader) Close() (err error)

Close is ...

func (*Reader) Read

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

Read is ...

func (*Reader) WriteTo

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

WriteTo is ...

type Writer

type Writer struct {
	// Writer is ...
	Writer io.WriteCloser
	// Cipehr is ...
	Cipher *Cipher
	// AEAD is ...
	AEAD cipher.AEAD
	// contains filtered or unexported fields
}

Writer is ...

func NewWriter

func NewWriter(w io.WriteCloser, cipher *Cipher) *Writer

NewWriter is ...

func (*Writer) Close

func (w *Writer) Close() (err error)

Close is ...

func (*Writer) ReadFrom

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

ReadFrom is ...

func (*Writer) Write

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

Write is ...

Jump to

Keyboard shortcuts

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