moonquic quic transport

rfc 9000 · 9001 · 9002 · multipath

QUIC, on the wire,
with nothing else.

A transport in which every packet is a field list you can point at, every path numbers its own packets, and a resumed connection spends what its ticket remembered. No socket, no clock, no TLS of its own: hand it a datagram and the time.

Initial packet 16 bytes a row · 8 bits a column

three decisions

What this library keeps,
and what it leaves to you

The transport is complete: handshake state, loss recovery, streams, flow control, 0-RTT and multipath. What it does not have is an opinion about where the bytes come from.

Bytes in, events out

No socket, no runtime, no thread. The peer's address is a type parameter and every entry point takes now in microseconds, so a UDP loop, a proxy or a test harness is yours to write — and the transport does not change shape inside any of them.

A number space per path

Multipath, second stage: each path after the handshake's has its own packet numbers, its own round-trip estimate, congestion window and PATH_ACK — and a nonce that names the path, so two paths never kindle the same key stream.

0-RTT from the ticket

A ticket is kept with the transport parameters it was issued under, so the next connection knows exactly what early data may spend. RFC 9000 §7.4.1 forbids guessing it; Config's two fields overrule the remembered values rather than replacing them.

the showcase

Every field, in its place

A real Initial packet, sealed by this library and printed by it: the header field by field, the frames it carries, and the transport parameters a handshake puts beside them.

the first bytes of the packet, printed by the library — this line is replaced in the browser

Open it field by field

packages

Six packages, one transport

Two of them are pure codecs over moonvar/quic, so a tool that only reads packets off a capture links nothing else.

PackageWhat it covers
frameRFC 9000 §19 in full, the ACK range encoding both ways, RFC 9221 datagrams, and the multipath frames with their own type codes.
packetLong and short headers, Retry, version negotiation, packet numbers and the three spaces.
cryptoPacket and header protection, the Retry tag, key update, and the path-and-packet-number nonce multipath needs.
recoveryRound-trip estimate, both loss thresholds, probe timeout, NewReno, CUBIC and BBR behind one trait, persistent congestion, pacing.
streamStream ids and reassembly, both state machines, flow control, the stream quota, a round-robin scheduler.
connTransport parameters, the handshakes, the connection table and event loop, migration, stateless reset, 0-RTT, and multipath.

boundaries

What is not here

Three things were left out on purpose, and each has a home in the same family.

Sockets and clocks. A transport that reads the time itself cannot be tested against a loss pattern, and one that owns a socket cannot be embedded. Datagram I/O is moonnet's; this library is pure enough to run inside a browser tab, which is how the packet on this page was printed.

The TLS handshake. moontls's, whose key schedule RFC 9001 §5.2 reuses verbatim. What arrives here is a key step and a byte stream to feed; a signing key never enters this library.

HTTP/3 and QPACK. Those are moonhttp's, because HTTP/3 is a version of HTTP and QPACK is to it what HPACK is to HTTP/2. This library moves streams and datagrams; what a stream means is above it.