protocol

package
v0.0.0-...-07cd40f Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPacket = 1 << 21
)

Variables

This section is empty.

Functions

func GetBuffer

func GetBuffer(size int) *bytes.Buffer

func PutBuffer

func PutBuffer(b *bytes.Buffer)

func VarIntSize

func VarIntSize[T int | int32](n T) (i int)

VarIntSize returns the number of bytes n takes up

Types

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

func NewDecoder

func NewDecoder(r io.Reader) *Decoder

func (*Decoder) DecodePacket

func (d *Decoder) DecodePacket() ([]byte, error)

func (*Decoder) EnableDecryption

func (d *Decoder) EnableDecryption(block cipher.Block, iv []byte)

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func NewEncoder

func NewEncoder(b *bytes.Buffer) *Encoder

func (*Encoder) EnableEncryption

func (enc *Encoder) EnableEncryption(block cipher.Block, iv []byte)

func (*Encoder) EncodePacket

func (enc *Encoder) EncodePacket(data []byte) error

func (*Encoder) Flush

func (enc *Encoder) Flush() []byte

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

func NewReader

func NewReader(r io.Reader) *Reader

func (*Reader) EnableDecryption

func (r *Reader) EnableDecryption(block cipher.Block, iv []byte)

func (*Reader) Next

func (r *Reader) Next(n int) ([]byte, error)

Next returns the next n bytes in the buffer and advances the reader. If n is bigger than the buffer then it returns bufio.ErrBufferFull without data and won't advance the reader.

func (*Reader) Read

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

func (*Reader) ReadByte

func (r *Reader) ReadByte() (byte, error)

func (*Reader) ReadVarInt

func (r *Reader) ReadVarInt() (int, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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