types

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthHeaderSize added in v0.3.6

func AuthHeaderSize(auth Auth, prefix bool) int

func DecodePacket

func DecodePacket(r []byte, auth Auth, prefix bool) ([]byte, netapi.Address, error)

func EncodePacket

func EncodePacket(w *pool.Buffer, addr net.Addr, buf []byte, auth Auth, prefix bool) error

func MaxPacketHeaderSize added in v0.3.8

func MaxPacketHeaderSize(auth Auth, prefix bool) int

func Salt

func Salt(password []byte) []byte

Types

type Aead

type Aead interface {
	New([]byte) (cipher.AEAD, error)
	KeySize() int
	NonceSize() int
	Name() []byte
}

type Auth

type Auth interface {
	cipher.AEAD
	KeySize() int
	Key() []byte
}

type Buffer

type Buffer interface {
	Len() int
	Bytes() []byte
	Write(b []byte) (int, error)
	WriteByte(b byte) error
}

type Handshaker

type Handshaker interface {
	Handshake(net.Conn) (net.Conn, error)
	EncodeHeader(Header, Buffer)
	DecodeHeader(pool.BufioConn) (Header, error)
}

type Hash

type Hash interface {
	New() hash.Hash
	Size() int
}
type Header struct {
	Addr      netapi.Address
	MigrateID uint64
	Protocol  Protocol
}

type PacketBuffer

type PacketBuffer interface {
	Buffer
	Advance(int)
	Retreat(i int)
}

type Protocol

type Protocol byte

Protocol network type +---------+-------+ | 1 byte | +---------+-------+ | 5bit | 3bit | +---------+-------+ | opts |prtocol| +---------+-------+

history: 66: 0b01000 010 77: 0b01001 101 78: 0b01001 110

so 0b01000 000, 0b01001 000 is reserved, because it already used on history

0b00001 000 is reserved for future extension that all opts bits used

var (
	TCP Protocol = 0b00000010 // 2
	// Deprecated: use UDPWithMigrateID
	UDP Protocol = 0b00000101 // 5
	// UDPWithMigrateID udp with migrate support
	UDPWithMigrateID Protocol = 0b00000110 // 6
)

func (Protocol) Network added in v0.3.8

func (n Protocol) Network() Protocol

func (Protocol) Unknown

func (n Protocol) Unknown() bool

type Signer

type Signer interface {
	Sign(rand io.Reader, digest []byte) (signature []byte, err error)
	SignatureSize() int
	Verify(message, sig []byte) bool
}

Jump to

Keyboard shortcuts

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