h3_util/lib.rs
1//! HTTP/3 server and client utilities used by [`tonic-h3`] and [`axum-h3`].
2//!
3//! This crate abstracts QUIC transports behind two traits so that the same
4//! HTTP/3 server and client code can run over any supported backend:
5//!
6//! - [`client::H3Connector`] — establishes client-side QUIC connections.
7//! - [`server::H3Acceptor`] — accepts server-side QUIC connections.
8//!
9//! On the client side, [`client::H3Channel`] wraps an [`client::H3Connector`]
10//! into a [`tower::Service`]/`tonic`-compatible channel that transparently
11//! (re)connects when the underlying HTTP/3 driver ends.
12//!
13//! # Backends
14//!
15//! Each backend is gated behind a cargo feature and exposes its own
16//! `H3Connector`/`H3Acceptor` implementations:
17//!
18//! | Feature | Backend | Module | Support |
19//! |---------|---------|--------|---------|
20//! | `quinn` | [Quinn](https://github.com/quinn-rs/quinn) | `quinn` | **production** |
21//! | `msquic` | [MsQuic](https://github.com/youyuanwu/msquic-h3) | `msquic` | experimental |
22//! | `s2n-quic` | [s2n-quic](https://github.com/aws/s2n-quic) | `s2n` | experimental |
23//! | `quiche` | [quiche](https://github.com/cloudflare/quiche) | `quiche_h3` | experimental |
24//!
25//! No backend is enabled by default; enable the one you need, e.g.
26//! `features = ["quinn"]`.
27//!
28//! **Only the `quinn` backend is supported for production use.** The `msquic`,
29//! `s2n-quic`, and `quiche` backends are experimental and provided for
30//! evaluation only. They have known limitations — for example, they do not
31//! release the listening UDP socket promptly on server shutdown.
32//!
33//! [`tonic-h3`]: https://github.com/youyuanwu/tonic-h3
34//! [`axum-h3`]: https://crates.io/crates/axum-h3
35//! [`tower::Service`]: https://docs.rs/tower/latest/tower/trait.Service.html
36
37pub mod client;
38pub mod client_body;
39mod client_conn;
40pub mod executor;
41#[cfg(feature = "msquic")]
42pub mod msquic;
43#[cfg(feature = "quinn")]
44pub mod quinn;
45mod send_guard;
46pub mod server;
47pub mod server_body;
48
49/// s2n backend
50#[cfg(feature = "s2n-quic")]
51pub mod s2n;
52
53#[cfg(feature = "quiche")]
54pub mod quiche_h3;
55
56pub type Error = Box<dyn std::error::Error + Send + Sync>;
57pub use std::error::Error as StdError;