proto

package
v0.0.0-...-82b4563 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: LGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BadPacketIdError = errors.New("bad packet id")
View Source
var BadPacketTypeError = errors.New("bad packet type")
View Source
var PacketNotFullyDecodedError = errors.New("packet not fully decoded")

Functions

func LookUpTypeByPacketInfo

func LookUpTypeByPacketInfo(direction proto_base.Direction, state proto_base.State, pid, version int32) (p proto_base.PacketInfo, ok bool)

func LookUpTypeByPacketInfoAndCopyType

func LookUpTypeByPacketInfoAndCopyType(direction proto_base.Direction, state proto_base.State, pid, version int32) (p proto_base.EncodeDecodeAble, ok bool)

func LookupPacketInfoByType

func LookupPacketInfoByType(packet proto_base.EncodeDecodeAble) (p proto_base.PacketInfo, ok bool)

func LookupPacketInfoByTypeLookupPacketInfoByTypeAndMore

func LookupPacketInfoByTypeLookupPacketInfoByTypeAndMore(packet proto_base.EncodeDecodeAble, state proto_base.State) (p proto_base.PacketInfo, ok bool)

Types

type Conn

type Conn struct {
	RawConn
	*event.Loop

	Actor           proto_base.Actor
	Version         string
	ProtocolVersion int32
	// contains filtered or unexported fields
}

func (*Conn) OnTick

func (c *Conn) OnTick(_ event.Tick) (err error)

func (*Conn) Receive

func (c *Conn) Receive() (packet proto_base.EncodeDecodeAble, err error)

func (*Conn) Send

func (c *Conn) Send(packet proto_base.EncodeDecodeAble) (err error)

func (*Conn) SetState

func (c *Conn) SetState(state proto_base.State)

func (*Conn) SetVersion

func (c *Conn) SetVersion(version string) (err error)

func (*Conn) Start

func (c *Conn) Start(handlers ...any) (err error)

func (*Conn) State

func (c *Conn) State() proto_base.State

type RawConn

type RawConn struct {
	net.Conn
	R                    io.Reader
	W                    io.Writer
	CompressionThreshold int32
}

func (*RawConn) ReceiveRaw

func (c *RawConn) ReceiveRaw() (packetBytes []byte, err error)

func (*RawConn) SendRaw

func (c *RawConn) SendRaw(rawPacketBytes []byte) (err error)

func (*RawConn) SetSecret

func (c *RawConn) SetSecret(sharedSecret []byte) (err error)

type UnCodablePacket

type UnCodablePacket struct {
	Err       error
	Data      []byte
	Direction proto_base.Direction
}

UnCodablePacket represents a packet that could not be decoded due to proto_generated not supporting all packets.

func (*UnCodablePacket) Decode

func (u *UnCodablePacket) Decode(r io.Reader) (err error)

func (*UnCodablePacket) Encode

func (u *UnCodablePacket) Encode(w io.Writer) (err error)

Jump to

Keyboard shortcuts

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