quic-go
A production-ready, pure-Go implementation of the QUIC transport protocol and HTTP/3, powering Caddy, Traefik, and cloudflared.
Repository Health
Technical Analysis
quic-go implements the QUIC transport protocol (RFC 9000/9001/9002) and HTTP/3 (RFC 9114) entirely in Go, with no cgo or external C dependencies. It covers the full QUIC specification surface — connection migration, 0-RTT resumption, unreliable datagrams (RFC 9221), Path MTU discovery (RFC 8899), QUIC v2 (RFC 9369), and stream resets with partial delivery — alongside an HTTP/3 client and server built on top of it.
The project is maintained with production rigor: continuous fuzzing via OSS-Fuzz and ClusterFuzzLite, interop testing against other QUIC implementations, benchmark regression tracking via Codspeed, and FIPS 140-3 support when built with Go’s standard-library cryptography. It is the transport layer behind large infrastructure projects including Caddy, Traefik, cloudflared, syncthing, and go-libp2p (which underlies IPFS and Filecoin), making it one of the most battle-tested QUIC stacks outside of browser vendors’ own implementations.
What You Get
- Core QUIC transport -
TransportandConntypes for dialing and listening for QUIC connections with full control overtls.Configand QUIC-specific options. - Bidirectional and unidirectional streams - multiplexed, flow-controlled streams with
OpenStream/AcceptStream, independent of the underlying connection’s congestion state. - HTTP/3 client and server (
http3package) - implementshttp.RoundTripperandhttp.Handlerso existingnet/httpcode can serve or fetch over HTTP/3 with minimal changes. - Unreliable datagrams (RFC 9221) - send unordered, unreliable messages over an established QUIC connection for latency-sensitive use cases.
- Connection migration and path management - built-in
path_managerhandles address changes (e.g. Wi-Fi to cellular handoff) without tearing down the connection. - qlog and qlogwriter packages - structured QUIC event logging conforming to the IETF qlog schema, for debugging and interop analysis.
- 0-RTT resumption -
TokenStoreinterface for caching resumption tokens to skip a round trip on reconnection. - Pluggable congestion control - a Cubic-based sender in
internal/congestionwith hybrid slow start and pacing, plus aConnectionIDGeneratorinterface for custom connection ID schemes.
Common Use Cases
- Web servers wanting HTTP/3 - drop the
http3package’sServerin alongside (or instead of)net/httpto serve HTTP/3 traffic, as Caddy and Traefik do. - Tunneling and reverse-proxy tools - cloudflared, frp, and Hysteria use quic-go’s low-level
Transport/ConnAPI to multiplex tunneled traffic over a single encrypted, congestion-controlled connection. - P2P and overlay networks - go-libp2p uses quic-go as a transport for IPFS (Kubo) and Filecoin (Lotus), relying on its connection migration for mobile/NAT scenarios.
- File sync and real-time apps - syncthing and Mercure use QUIC streams and datagrams for low-latency, loss-tolerant data exchange between peers.
- Custom application protocols over QUIC - the
Conn/StreamAPI lets you build a bespoke wire protocol (RPC, streaming, pub/sub) directly on QUIC’s multiplexed, encrypted transport instead of TCP.
Under The Hood
Architecture
quic-go is organized as a layered stack: the root package exposes the public Conn/Stream/Transport API and orchestrates a connection.go state machine (over 100KB, the largest file in the repo) that ties together packet packing/unpacking, the crypto/handshake state machine (internal/handshake), flow control (flow_controller_*.go), stream multiplexing (streams_map*.go), and ACK/loss handling (internal/ackhandler). Congestion control lives in its own internal/congestion package (Cubic sender, hybrid slow start, pacer), and wire-format encoding/decoding is isolated in internal/wire and quicvarint. The http3 package is a separate, self-contained layer built entirely on top of the public Conn/Stream interfaces rather than reaching into internals, which keeps HTTP/3 swappable and demonstrates the core transport’s API is genuinely usable by third parties. This is a textbook layered protocol-stack architecture: replacing the congestion controller or the handshake crypto backend would touch internal/congestion or internal/handshake without rippling into stream or connection-migration logic.
Tech Stack
Pure Go with zero cgo dependencies, targeting the latest two Go releases (currently requiring Go 1.26 for FIPS support). Direct dependencies are minimal and deliberate: golang.org/x/crypto and golang.org/x/net for TLS 1.3/QUIC-adjacent primitives, github.com/quic-go/qpack for HTTP/3 header compression, golang.org/x/sys for platform syscalls (used heavily in sys_conn_*.go for OS-specific UDP socket tuning like GSO and the Don’t-Fragment bit across Linux/Darwin/Windows/OpenBSD/FreeBSD), and go.uber.org/mock plus stretchr/testify for testing. No web framework or database layer applies here — this is infrastructure, not an application.
Code Quality
Exceptionally strong signals for a low-level networking library: 230 _test.go files against 443 total .go files (roughly 1:1), extensive use of generated mocks (mockgen.go files throughout) for interface-boundary testing, and multiple dedicated CI workflows for unit tests, lint (golangci-lint with a curated ruleset banning math/rand in favor of math/rand/v2, enforcing prealloc, unparam, etc.), interop testing against other QUIC stacks, cross-compilation, govulncheck scanning, and continuous fuzzing via OSS-Fuzz/ClusterFuzzLite — unusually thorough for a protocol implementation where malformed-input handling is a real attack surface. Benchmark regressions are tracked via Codspeed CI.
Tech Stack (API Design)
The public API deliberately mirrors Go’s standard net package idioms (Dial, Listen, Conn, Stream with Read/Write) so developers already familiar with TCP-based Go networking code have almost no new mental model to learn, while http3.Server/http3.RoundTripper implement the standard net/http interfaces directly so a server can add HTTP/3 support by wiring in one additional type rather than restructuring routing or handler code. Configuration is a single flat Config struct with well-documented defaults for every timeout and flow-control window, avoiding the builder-pattern sprawl common in comparable libraries.
Used by 5 apps in this directory
Caddy
Devops · Security
The only web server that obtains and renews TLS certificates automatically, with HTTP/1-2-3 support and zero dependency on external runtimes.
frp
Networking
A fast reverse proxy that exposes local servers behind NAT or firewalls to the public internet with multi-protocol support.
NetBird
Security
Replace your VPN with a zero-trust WireGuard overlay network that auto-connects devices, enforces SSO and posture checks, and deploys in under 5 minutes.
Teleport
Security · Authentication
Zero-trust infrastructure access platform that replaces credentials and VPNs with short-lived certificates, SSO, and identity-aware proxies for SSH, Kubernetes, databases, RDP, and AI agents.
Traefik
Devops · Automation · Security
A cloud-native reverse proxy and load balancer that auto-configures itself from Docker, Kubernetes, and other orchestrators — zero manual routing required.