Module packet

Source
Expand description

§Packet

This file is part of the Network Protocol project.

It defines the Packet structure and handles all related serialization and deserialization logic.

The Packet struct represents a fully decoded protocol packet, including the protocol version, magic header, and binary payload.

This module uses the bincode crate for efficient binary encoding. Protocol constants like MAGIC_BYTES and PROTOCOL_VERSION are defined in the config module.

§Responsibilities

  • Decode packets from raw byte buffers
  • Encode Packet structs into raw bytes
  • Validate protocol headers and versions

The design is optimized for performance and integration with the rest of the protocol layer.

Structs§

Packet
Represents a fully decoded protocol packet

Constants§

HEADER_SIZE
Total size of the fixed-length header