nwd1 0.1.0

Binary framing protocol for QUIC / HTTP3 streams using NetId64 identifiers. Frame layout: MAGIC | LEN | ID(8B) | KIND(1B) | VER(8B) | PAYLOAD.
Documentation
  • Coverage
  • 0%
    0 out of 13 items documented0 out of 4 items with examples
  • Size
  • Source code size: 7.51 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 219.92 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • iadev09/nwd1
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • iadev09

nwd1

Binary framing protocol for QUIC / HTTP3 streams using NetId64 identifiers.

nwd1 defines a minimal, endian-safe, fixed-layout frame format suitable for both QUIC and HTTP/3 transports.
It is designed to be efficient, testable, and transport-agnostic — a foundation for reliable streaming protocols.

nwd1 is not a full network protocol — it is the binary frame foundation
on which higher-level communication systems can be built.
It defines how data is shaped and identified, not what it means.


🧱 Frame Layout

MAGIC (4B) | LEN (4B) | ID (8B) | KIND (1B) | VER (8B) | PAYLOAD (variable)

Note: The | characters shown above are visual separators only.

They are not present in the actual binary data — the frame is a continuous byte stream.

Field Size Description
MAGIC 4 bytes Constant header b"NWD1". Used to identify the protocol.
LEN 4 bytes Total length of the following bytes (big-endian u32).
ID 8 bytes 64-bit network ID (NetId64) → KIND | NODE | COUNTER.
KIND 1 byte Frame type (application-defined).
VER 8 bytes Protocol or schema version (u64, BE).
PAYLOAD variable Raw binary content.

⚙️ Example

use nwd1::{Frame, encode, decode};
use netid64::NetId64;
use bytes::Bytes;

let frame = Frame {
id: NetId64::make(1, 7, 42),
kind: 1,
ver: 1,
payload: Bytes::from_static(b"hello"),
};

// Encode to binary
let data = encode( & frame);

// Decode back
let decoded = decode( & data).unwrap();
assert_eq!(decoded.id.raw(), frame.id.raw());
assert_eq!(decoded.payload, frame.payload);