Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseHeader ¶
ParseHeader parses raw header bytes into a user-defined protobuf struct. It unmarshals the header and extracts the Msgid field (case-insensitive, supports underscores and dashes).
func WritePacket ¶ added in v1.0.16
func WritePacket(ctx context.Context, conn net.Conn, header proto.Message, body proto.Message) error
WritePacket marshals and writes a packet with the given header and body to the provided connection. The packet layout is: [headLen:1][bodyLen:2][headBytes][bodyBytes]. It injects the given msgID into the header's Msgid field if available. It enforces max header (255 bytes) and body (65535 bytes) size constraints.
Types ¶
type PacketEnvelope ¶
func ParseEnvelope ¶
func ParseEnvelope(conn net.Conn) (*PacketEnvelope, error)
ParseEnvelope extracts the raw header and body using the first three bytes.
Click to show internal directories.
Click to hide internal directories.