// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie // SPDX-License-Identifier: MIT //! QUIC — RFC 9000, RFC 9001 and RFC 9002 — for Zig. //! //! Early, and honest about it: what is here so far is the seam onto TLS and //! the packet protection that hangs off it. See the README for what that //! means and what is not here yet. //! //! ## The shape of the thing //! //! QUIC is three documents that only make sense together — the transport //! (RFC 9000), its use of TLS (RFC 9001), and loss detection and congestion //! control (RFC 9002) — and one design decision runs through all of them: the //! handshake is a component, not a protocol underneath. TLS supplies //! handshake messages and traffic secrets; QUIC does its own framing, its own //! packet protection, its own loss recovery, and its own idea of a stream. //! //! `tls.Handshake` is where that boundary is written down. It is deliberately //! an interface with no implementation behind it in this repository, because //! the alternative — picking a TLS library and building on its shape — is how //! a transport ends up unable to change one. //! //! ## Why this is not part of zig-http //! //! Because DNS over QUIC (RFC 9250) has no HTTP in it anywhere. A QUIC //! implementation that lived inside an HTTP server library would have to be //! depended on by a DNS client in order to send a DNS query, which is the //! reductio. HTTP/3 needs QUIC; QUIC needs nothing from HTTP, and the arrow //! points one way. const std = @import("std"); pub const ack = @import("ack.zig"); pub const Connection = @import("Connection.zig"); pub const frame = @import("frame.zig"); pub const mtu = @import("mtu.zig"); /// n0's NAT traversal: candidate addresses, rounds and probes. pub const nat = @import("nat.zig"); pub const outgoing = @import("outgoing.zig"); pub const packet = @import("packet.zig"); pub const parameters = @import("parameters.zig"); pub const path = @import("path.zig"); pub const protection = @import("protection.zig"); pub const reassembly = @import("reassembly.zig"); pub const close = @import("close.zig"); /// §13.4: whether a path carries ECN markings honestly. The marking itself /// is two bits of the IP header, which this library never touches. pub const ecn = @import("ecn.zig"); pub const congestion = @import("congestion.zig"); pub const connection_id = @import("connection_id.zig"); pub const recovery = @import("recovery.zig"); pub const retry = @import("retry.zig"); pub const stateless_reset = @import("stateless_reset.zig"); pub const stream = @import("stream.zig"); pub const tls = @import("tls.zig"); /// `tls.Handshake` over the sans-I/O TLS 1.3 in tls.zig, which is the first /// thing to sit behind the seam. pub const tls_handshake = @import("tls_handshake.zig"); pub const varint = @import("varint.zig"); /// RFC 9001 Appendix A's worked example, as data and as tests. pub const rfc9001 = @import("rfc9001.zig"); /// The QUIC version this implements: RFC 9000's version 1. /// /// The number is in the long header of every packet that has one, and it is /// what a version-negotiation packet lists alternatives to. pub const version_1: u32 = 0x0000_0001; test { refAllDeclsRecursive(@This(), ""); } /// `std.testing.refAllDecls`, carried down into every public type declared /// in this module -- so that a test written inside one, a doctest on a /// method above all, is compiled and run rather than silently left out. A /// test in a container nothing refers to is never analyzed, and 0.17 has no /// recursive form of its own. /// /// A type is followed only where it was declared: its name has to be the /// name of the decl holding it, under the name of the type holding that. /// An alias -- `pub const Allocator = std.mem.Allocator`, a type re-exported /// from another file -- fails the test and is left alone, which is what /// stops this wandering into the standard library or round in a circle. fn refAllDeclsRecursive(comptime T: type, comptime prefix: []const u8) void { inline for (comptime std.meta.declarations(T)) |name| { const decl = &@field(T, name); if (@TypeOf(decl.*) != type) continue; const D = decl.*; switch (@typeInfo(D)) { .@"struct", .@"union", .@"enum", .@"opaque" => {}, else => continue, } if (comptime std.mem.eql(u8, @typeName(D), prefix ++ name)) refAllDeclsRecursive(D, @typeName(D) ++ "."); } }