Skip to main content

Module protocol

Module protocol 

Source
Expand description

Multiplayer networking protocol: packet encoding, decoding, auth tokens, bandwidth tracking, and packet filtering.

Custom binary wire format (no serde dependency):

  • Variable-length integers for sequence numbers
  • Bit-packed flags in the header
  • Delta encoding hints for position payloads
  • 16-byte header, variable payload

Structs§

BandwidthTracker
Rolling-window bandwidth meter.
ConnectionToken
Opaque token issued by the auth server, embedded in the Connect packet.
Packet
A fully-parsed network packet ready for dispatch.
PacketDecoder
Deserializes packets from a byte buffer with strict bounds checking.
PacketEncoder
Serializes Packet values to a contiguous byte buffer.
PacketFilter
Tracks recently seen sequence numbers to detect replay attacks and malformed packets before they reach higher-level code.
PacketHeader
Fixed-size header that precedes every packet on the wire.

Enums§

CompressionHint
Indicates how the payload bytes are compressed. The receiver must use matching decompression.
PacketKind
Discriminant for every packet type on the wire.
ProtocolError
All errors that can arise from encoding or decoding packets.

Constants§

FILTER_HISTORY_LEN
Maximum packets stored in replay/filter history.
MAGIC
Magic bytes at the start of every packet (PEMP = Proof-Engine Multiplayer Protocol).
MAX_PAYLOAD_LEN
Maximum allowed payload length (64 KiB).
PROTOCOL_VERSION
Wire protocol version negotiated on connect.