quic_lib library
A comprehensive, pure-Dart implementation of the QUIC protocol stack.
quic_lib provides a fully Dart-native networking stack covering four major subsystems built on top of each other:
- QUIC transport — RFC 9000/9001/9002 compliant wire format, packet protection, handshake, stream multiplexing, flow control, congestion control, and connection migration.
- HTTP/3 — RFC 9114 mapping of HTTP semantics onto QUIC streams with QPACK header compression.
- WebTransport — RFC 9220 datagram and stream sessions over HTTP/3.
- libp2p QUIC — Transport, multiaddr parsing, and PeerId handling for libp2p networks.
Quick start
Import the full public API in one line:
import 'package:quic_lib/quic_lib.dart';
Create an endpoint, connect to a peer, and open a bidirectional stream:
import 'dart:io';
import 'dart:typed_data';
import 'package:quic_lib/quic_lib.dart';
Future<void> main() async {
final endpoint = await QuicEndpoint.bind(InternetAddress.anyIPv4, 0);
final connection = await endpoint.connect(
InternetAddress.loopbackIPv4,
4433,
);
final streamId = connection.openBidirectionalStream();
final frame = StreamFrame(
streamId: streamId,
data: Uint8List.fromList([1, 2, 3]),
fin: true,
);
// Packetize and send via PacketSender...
connection.close();
endpoint.close();
}
Subsystem barrel files
If you only need a subset of the API, import one of the focused barrel files instead:
| Barrel file | Exports |
|---|---|
quic_lib.dart |
Everything — wire format, crypto, connection, streams, recovery, HTTP/3, WebTransport, libp2p |
quic.dart |
QUIC transport core only — endpoint, connection, stream scheduler, isolates |
http3.dart |
HTTP/3 layer — connection, request, response, frames, QPACK |
webtransport.dart |
WebTransport sessions, capsules, and stream types |
libp2p.dart |
libp2p transport — multiaddr, peer IDs, QUIC dial/listen |
See also:
quic.dart— QUIC transport only.http3.dart— HTTP/3 client and server.webtransport.dart— WebTransport sessions.libp2p.dart— libp2p QUIC transport.
Classes
- AckEcnFrame
- An ACK frame with ECN (Explicit Congestion Notification) counts (RFC 9000 Section 19.3.2).
- AckFrame
- An ACK frame (RFC 9000 Section 19.3).
- AckFrequencyFrame
- An ACK_FREQUENCY frame allows a receiver to request the sender to change its acknowledgement frequency.
- AckFrequencyPolicy
- Policy state derived from ACK_FREQUENCY frames (RFC 9298).
- AckGenerator
- Generates ACK frames based on received packets.
- AckRange
- A single range of contiguous packet numbers acknowledged in an ACK frame.
- AeadAlgorithm
- AEAD algorithm descriptor.
- AeadResult
- Result of an AEAD encryption operation.
- Aes128Gcm
- AES-128-GCM AEAD algorithm constants.
- Aes256Gcm
- AES-256-GCM AEAD algorithm constants.
- ApplicationCloseFrame
- A CONNECTION_CLOSE frame for application errors (RFC 9000 Section 19.19).
- BbrCongestionController
- BBR (Bottleneck Bandwidth and Round-trip propagation time) congestion controller per RFC 8382.
- CertificateEntry
- TLS 1.3 CertificateEntry structure per RFC 8446 Section 4.4.2.
- CertificateMessage
- TLS 1.3 Certificate structure per RFC 8446 Section 4.4.2.
- CertificateVerify
- TLS 1.3 CertificateVerify structure per RFC 8446 Section 4.4.3.
- ChaCha20Poly1305
- ChaCha20-Poly1305 AEAD algorithm constants.
- CipherSuite
- TLS cipher suite identifier (2 bytes).
- ClientHello
- TLS 1.3 ClientHello structure per RFC 8446 Section 4.1.2.
- CoalescedPacket
- Splits UDP datagrams that may contain multiple QUIC coalesced packets.
- CongestionController
- NewReno congestion controller per RFC 9002 Section 7.
- ConnectionCloseFrame
- A CONNECTION_CLOSE frame for transport errors (RFC 9000 Section 19.19).
- ConnectionIdManager
- Manages the lifecycle of Connection IDs for a single QUIC connection.
- ConnectionIsolate
- Manages a single QUIC connection inside its own isolate.
- ConnectionRegistry
- A registry that maps destination connection IDs to connection objects.
- ConnectionStateMachine
- Manages the QUIC connection lifecycle state machine.
- CryptoBackend
- Crypto primitive backend abstraction.
- CryptoFrame
- A CRYPTO frame (RFC 9000 Section 19.6).
- CubicCongestionController
- RFC 8312 / RFC 9002 CUBIC congestion controller.
- DataBlockedFrame
- A DATA_BLOCKED frame (RFC 9000 Section 19.12).
- DatagramFrame
- A DATAGRAM frame (RFC 9221 Section 4).
- DCUtRStateMachine
- Finite state machine that tracks DCUtR handshake progress.
- DefaultCryptoBackend
-
Default implementation of CryptoBackend using
package:cryptographyandpackage:pointycastle. - EncryptedExtensions
- TLS 1.3 EncryptedExtensions structure per RFC 8446 Section 4.3.1.
- FinishedMessage
- TLS 1.3 Finished message per RFC 8446 Section 4.4.4.
- FlowController
- QUIC flow controller for connection-level and stream-level flow control.
- Frame
- Base class for all QUIC frames.
- FrameCodec
- Codec for serializing and parsing QUIC frames (RFC 9000 Section 12 and 19).
- HandshakeDoneFrame
- A HANDSHAKE_DONE frame (RFC 9000 Section 19.20).
- HandshakeStateMachine
- Manages the TLS 1.3 handshake lifecycle for a single QUIC connection (RFC 8446).
- HashAlgorithm
- Hash algorithm descriptor.
- HeaderProtection
- QUIC header protection per RFC 9001 Section 5.4.
- Http3CancelPushFrame
- HTTP/3 CANCEL_PUSH frame payload.
- Http3Frame
- An HTTP/3 frame consisting of a type, length, and payload.
- Http3GoawayFrame
- HTTP/3 GOAWAY frame payload.
- Http3HeadersFrame
- HTTP/3 HEADERS frame payload.
- Http3PushPromiseFrame
- HTTP/3 PUSH_PROMISE frame payload.
- Http3SettingsFrame
- HTTP/3 SETTINGS frame payload.
- Http3StreamHandler
- Handles classification of an HTTP/3 stream based on its QUIC stream ID.
- Hystart
- Hystart++ / basic Hystart helper for early slow-start exit.
- InitialSecrets
- QUIC Initial Secret derivation per RFC 9001 Section 5.2.
- IsolateSupervisor
- Tracks active connection isolates by connection ID.
- KeyDerivation
- QUIC key derivation from a traffic secret per RFC 9001 Section 5.1.
- KeyManager
- Derives and manages packet protection keys for all QUIC packet number spaces.
- KeyPair
- Opaque handle to a key pair.
- KeyUpdate
- QUIC Key Update derivation per RFC 9001 Section 6.
- Libp2pCertificateGenerator
- Generates an ephemeral self-signed X.509 certificate with the libp2p TLS extension for use in libp2p QUIC handshakes.
- Libp2pExtension
- The libp2p TLS X.509 certificate extension.
- Libp2pQuicConnection
- A libp2p-friendly wrapper around a QUIC connection.
- Libp2pQuicTransport
- A libp2p transport backed by QUIC.
- LongHeader
- QUIC long header used during handshake (Initial, 0-RTT, Handshake, Retry).
- LossDetector
- QUIC loss detector per RFC 9002 Section 6.
- MaxDataFrame
- A MAX_DATA frame (RFC 9000 Section 19.9).
- MaxStreamDataFrame
- A MAX_STREAM_DATA frame (RFC 9000 Section 19.10).
- MaxStreamsFrame
- A MAX_STREAMS frame (RFC 9000 Section 19.11).
- MigrationHelper
- Helper for QUIC connection path validation via PATH_CHALLENGE / PATH_RESPONSE.
- Multiaddr
- A self-describing network address following the libp2p multiaddr format.
- MultiaddrComponent
- A single protocol/value pair within a Multiaddr.
- MultistreamSelect
- libp2p multistream-select / protocol negotiation.
- NewConnectionIdFrame
- A NEW_CONNECTION_ID frame (RFC 9000 Section 19.15).
- NewSessionTicket
- RFC 8446 NewSessionTicket handshake message.
- NewTokenFrame
- A NEW_TOKEN frame (RFC 9000 Section 19.7).
- NonceGenerator
- QUIC packet nonce construction per RFC 9001 Section 5.3.
- PacingCalculator
- QUIC packet pacing calculator.
- PacketBuilder
- Builds complete QUIC packets from headers and frames.
- PacketHeader
- Base class for all QUIC packet headers.
- PacketHeaderParser
- Parses QUIC packet headers from raw bytes.
- PacketNumber
- QUIC packet number encoding and reconstruction per RFC 9000 Section 17.1.
- PacketNumberSpaceManager
- Manages packet number allocation, tracking of largest acknowledged, and largest received packet numbers across all three QUIC packet number spaces.
- PacketProtector
- QUIC Packet Protection (AEAD encrypt/decrypt).
- PacketReceiver
- Processes incoming QUIC packets from raw UDP datagrams.
- PacketSender
- Builds and tracks outgoing QUIC packets.
- PaddingFrame
- A PADDING frame (RFC 9000 Section 19.1).
- PathChallengeFrame
- A PATH_CHALLENGE frame (RFC 9000 Section 19.17).
- PathResponseFrame
- A PATH_RESPONSE frame (RFC 9000 Section 19.18).
- PeerId
- A libp2p PeerId represented as the raw multihash bytes of a public key.
- PingFrame
- A PING frame (RFC 9000 Section 19.2).
- PtoScheduler
- QUIC Probe Timeout (PTO) scheduler per RFC 9002 Section 6.2.
- PublicKey
- Opaque handle to a public key.
- QpackDecoder
- QPACK field line decoder per RFC 9204 Section 4.3.
- QpackEncoder
- QPACK field line encoder per RFC 9204 Section 4.3. Supports both static and dynamic table lookups.
- QpackFieldLine
- A decoded QPACK field line.
- QpackInteger
- QPACK integer encoder/decoder per RFC 9204 Section 4.1.
- QpackStaticTable
- QPACK static table per RFC 9204 Appendix A.
- QpackStaticTableEntry
- A single entry in the QPACK static table.
- QpackString
- QPACK string literal encoder/decoder per RFC 9204 Section 4.2 (same as RFC 7541 §6.2).
- QuicBitGreaser
- Implements RFC 9287 greasing of the QUIC bit.
- QuicConnection
- Orchestrates all subsystems of a single QUIC connection.
- QuicEndpoint
- A QUIC endpoint that listens for and initiates connections over UDP.
- QuicReceiveStream
- QUIC receive-side stream.
- QuicSendStream
- QUIC send-side stream.
- QuicStream
- Base interface for a QUIC stream.
- QuicVersions
- QUIC version constants and helpers per RFC 9000 and RFC 9369.
- ReassemblyBuffer
- Reassembles out-of-order STREAM frame data into contiguous byte sequences.
- ReceiveStateMachine
- State machine for the receive side of a QUIC stream.
- ResetStreamFrame
- A RESET_STREAM frame (RFC 9000 Section 19.4).
- RetireConnectionIdFrame
- A RETIRE_CONNECTION_ID frame (RFC 9000 Section 19.16).
- RetryIntegrityTag
- QUIC Retry Integrity Tag computation and verification per RFC 9001 §5.8.
- RetryPacketBuilder
- Builds QUIC Retry packets per RFC 9000 Section 17.2.5.
- RoundRobinScheduler
- A round-robin implementation of StreamScheduler.
- RttEstimator
- QUIC RTT Estimator per RFC 9002 Section 5.
- SecretKey
- Opaque handle to a secret key.
- SendStateMachine
- Manages the lifecycle of the sending half of a QUIC stream (RFC 9000 Section 3.1).
- SentPacketInfo
- Metadata for a sent packet used by SentPacketTracker.
- SentPacketTracker
- Tracks sent packets per packet number space.
- ServerHello
- TLS 1.3 ServerHello structure per RFC 8446 Section 4.1.3.
- Sha256
- SHA-256 hash algorithm constants.
- Sha384
- SHA-384 hash algorithm constants.
- ShortHeader
- QUIC short header used for 1-RTT application data.
- SignedKey
- A protobuf-encoded signed key used in the libp2p TLS extension.
- StatelessResetGenerator
- Generates and validates QUIC stateless reset packets per RFC 9000 Section 10.3.
- StopSendingFrame
- A STOP_SENDING frame (RFC 9000 Section 19.5).
- StreamDataBlockedFrame
- A STREAM_DATA_BLOCKED frame (RFC 9000 Section 19.13).
- StreamFrame
- A STREAM frame (RFC 9000 Section 19.8).
- StreamId
- QUIC Stream ID encoding and allocation.
- StreamIdAllocator
- Allocates stream IDs for each of the four QUIC stream categories.
- StreamsBlockedFrame
- A STREAMS_BLOCKED frame (RFC 9000 Section 19.14).
- StreamScheduler
- Abstract interface for selecting the next QUIC stream to process.
- TlsConstants
- Protocol-wide constants for TLS 1.3 (RFC 8446).
- TlsExtension
- TLS extension as a generic type + opaque data block.
- UdpSocket
- V2LongHeader
- QUIC v2 long header per RFC 9369.
- VarInt
- QUIC variable-length integer encoding per RFC 9000 Section 16.
- VersionInformation
- RFC 9368 version_information transport parameter.
- VersionNegotiationPacket
- Version negotiation packet sent when a peer doesn't support the requested version.
- WebTransportSession
- Manages the state of a single WebTransport session over HTTP/3.
- WebTransportSessionManager
- Manages multiple WebTransport sessions over a single QUIC connection.
- WebTransportStreamId
- Discriminator and encoder/decoder for WebTransport stream IDs.
- ZeroRttHelper
- 0-RTT helper for QUIC.
Enums
- BbrState
- CapsuleType
- Capsule types for WebTransport over HTTP/3 (RFC 9220).
- ConnectionState
- The states of a QUIC connection lifecycle.
- HandshakeRole
- Role of the endpoint in the TLS handshake.
- HandshakeState
- Discrete states of the TLS 1.3 handshake state machine (RFC 8446).
- Http3FrameType
- HTTP/3 frame types per RFC 9114 Section 7.2.
- Http3SettingsId
- HTTP/3 SETTINGS identifiers per RFC 9114 Section 7.2.4.
- Http3StreamType
- HTTP/3 stream types per RFC 9114 Section 4.1.
- PacketNumberSpace
- QUIC packet number spaces per RFC 9000.
- QuicTransportErrorCode
- QUIC transport error codes per RFC 9000 Section 20.1.
- QuicTransportParameterId
- QUIC transport parameter identifiers (RFC 9000 and extensions).
- ReceiveStreamState
- QUIC receive-side stream states per RFC 9000 Section 3.2.
- SendStreamState
- Lifecycle states for the sending half of a QUIC stream (RFC 9000 Section 3.1).
- TlsContentType
- TLS record-layer content types (RFC 8446 Section 5.1).
- TlsExtensionType
- TLS extension type identifiers (RFC 8446 Section 4.2).
- TlsHandshakeType
- Identifiers for TLS 1.3 handshake message types (RFC 8446 Section 4).
- WebTransportStreamType
- WebTransport stream type discriminator.
Typedefs
- Capsule = WebTransportCapsule
- Deprecated alias for WebTransportCapsule.
-
ConnectionIdRecord
= ({List<
int> connectionId, int sequenceNumber, List<int> statelessResetToken}) - Record representing an active Connection ID.