protocol

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

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

Reader is used for reading packets from an io.Reader.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader creates a new Reader with the given io.Reader.

func (*Reader) ReadPacket

func (r *Reader) ReadPacket() ([]byte, error)

ReadPacket reads a packet from the underlying io.Reader. It first reads the length of the packet as an uint32 in big-endian order, then reads the actual packet data of that length.

type Writer

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

Writer is used for writing packets to an io.Writer.

func NewWriter

func NewWriter(w io.Writer) *Writer

NewWriter creates a new Writer with the given io.Writer.

func (*Writer) Write

func (w *Writer) Write(data []byte) (err error)

Write writes a packet to the underlying io.Writer. It prefixes the packet data with its length as an uint32 in big-endian order, then writes the prefixed data to the underlying io.Writer.

Jump to

Keyboard shortcuts

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