flare_mlake · API

flare.quic

flare.quic — sans-I/O QUIC v1 codec primitives (RFC 9000).

This package ships the codec layer of QUIC: pure byte-in / byte-out parsers and emitters for the wire format, plus pure state machines and congestion-controller helpers that operate on owned value-typed state. It contains no socket I/O and no TLS handshake. Every public type's contract is "give me bytes, get back a typed value (and optionally error context); give me a typed value, get back bytes".

The codec layer is the load-bearing foundation that downstream modules (the QUIC reactor + datagram pump, the TLS handshake adapter that drives the CRYPTO frames) will build on top of. Shipping the codec layer first lets us cross-validate against reference fixtures before committing to a particular reactor / TLS design.

Public re-exports:

  • :mod:.varint — variable-length integer codec (RFC 9000 §16): :class:Varint, :func:encode_varint, :func:decode_varint, :func:varint_encoded_length, :data:VARINT_MAX.
  • :mod:.packet — long / short header codec (RFC 9000 §17): :class:ConnectionId, :class:LongHeader, :class:ShortHeader, :class:InitialExtras, the PACKET_TYPE_* constants, and their byte-level helpers.
  • :mod:.frame — all 22 RFC 9000 §19 transport frames as typed payload structs plus :trait:FrameHandler + :func:parse_frame_into[H] for zero-carrier dispatch, and per-type encode_* writers that append to a caller-owned mut out: List[UInt8].
  • :mod:.transport_params — RFC 9000 §18 transport-parameter codec: :class:TransportParameters, :func:encode_transport_parameters, :func:decode_transport_parameters, and the TP_ID_* constants for every parameter the codec carries.
  • :mod:.state — RFC 9000 §3 / §13 sans-I/O connection + stream state machines: :class:Connection, :class:Stream, :func:handle_frame_buf, :func:mark_handshake_complete, :func:is_idle_timeout_expired, :func:connection_close, the per-typed-payload apply_* helpers, and the CONN_STATE_* / STREAM_STATE_* constants.
  • :mod:.crypto — sans-I/O QUIC v1 crypto math (RFC 9001 §5 + RFC 5869 + RFC 8446 §7.1): HKDF-Extract, HKDF-Expand, HKDF-Expand-Label, RFC 9001 §5.2 initial- secret derivation, plus the :trait:QuicCrypto AEAD trait surface that the QUIC server reactor binds against. :class:OpenSslQuicCrypto is the shipped backend; :class:StubQuicCrypto remains as a typed sentinel that raises, so tests can pin the trait boundary without linking OpenSSL.
  • :mod:.cc — RFC 9002 §7 congestion control: the :trait:CongestionController contract plus :class:RenoController (RFC 9002 NewReno) and :class:CubicController (RFC 9438 CUBIC with RFC 9406 HyStart++), selected by :class:CcChoice. The loss-recovery bookkeeping in _loss_recovery drives a controller on every ACK / loss.