Skip to main content
Mole designing protocol

Protocol Overview

Muti Metroo uses a binary frame-based protocol for all peer communication.

Protocol Version

Current version: 0x01

Frame Structure

Every frame has a 14-byte header followed by variable-length payload:

OffsetSizeFieldDescription
01 byteTypeFrame type identifier
11 byteFlagsFrame flags (e.g., FIN_WRITE, FIN_READ)
2-54 bytesLengthPayload length (big-endian)
6-138 bytesStreamIDStream identifier (big-endian)
14+variablePayloadFrame payload (0-16384 bytes)

Frame Types

See Frame Types for complete list.

Constants

ConstantValueDescription
Protocol Version0x01Current protocol version
Max Frame Payload16 KBMaximum payload size
Header Size14 bytesFixed header size
Control Stream ID0Reserved for control channel

Stream ID Allocation

  • Connection initiator (dialer): ODD IDs (1, 3, 5, ...)
  • Connection acceptor (listener): EVEN IDs (2, 4, 6, ...)
  • StreamID 0: Reserved for control messages

Connection Lifecycle

  1. Handshake: PEER_HELLO / PEER_HELLO_ACK exchange
  2. Operation: Stream and control frames
  3. Keepalive: KEEPALIVE / KEEPALIVE_ACK when idle
  4. Disconnect: Connection close or timeout

Timeouts

OperationTimeout
Handshake10s
Stream open30s
Keepalive interval5m
Keepalive timeout90s
Idle stream5m

See Limits for complete limits reference.