mechanics_http_server/lib.rs
1//! Opportunistic HTTP/3 server support for mechanics-family
2//! services.
3//!
4//! This crate provides two additive building blocks for binaries
5//! that already own their HTTP/1.1 and HTTP/2 TCP+TLS listener:
6//! an opt-in HTTP/3 QUIC listener and a tower middleware layer
7//! that emits `Alt-Svc` on the existing TCP+TLS path.
8//!
9//! Activation is controlled by [`Http3ServerConfig::bind_h3`].
10//! When it is `None`, [`Http3Server::start`] returns an inert
11//! handle immediately: no UDP socket is opened and no
12//! [`quinn::Endpoint`] is constructed. When it is `Some`, this
13//! crate binds that UDP address and routes HTTP/3 requests into
14//! the supplied tower service.
15//!
16//! TLS material is supplied by the caller as
17//! [`rustls::pki_types::CertificateDer`] and
18//! [`rustls::pki_types::PrivateKeyDer`]. The QUIC-side TLS
19//! configuration uses the `aws-lc-rs` rustls provider and ALPN
20//! `h3` only. This server crate deliberately has no
21//! `webpki-roots` dependency and no `ring` dependency.
22//!
23//! HTTP/1.1, HTTP/2 over TCP+TLS, and cleartext HTTP/1.1 remain
24//! the consumer binary's responsibility. This crate does not
25//! construct or alter those listeners.
26
27#![warn(missing_docs)]
28#![warn(rustdoc::broken_intra_doc_links)]
29
30mod alt_svc;
31pub mod axum_compat;
32mod body;
33mod error;
34mod server;
35mod zero_rtt;
36
37pub use alt_svc::{AltSvcLayer, AltSvcService, alt_svc_layer};
38pub use body::{H3RequestBody, H3RequestBodyError};
39pub use error::{Error, Result};
40pub use server::{Http3Handle, Http3Server, Http3ServerConfig};
41pub use zero_rtt::{default_zero_rtt_methods, is_zero_rtt_safe};
42
43#[cfg(test)]
44mod tests;