pub struct QuicConfig(/* private fields */);Expand description
User-facing QUIC configuration backed by quinn.
Constructed with TLS credentials and passed to
Config::with_quic.
The runtime and UDP transport types are inferred from the server.
trillium_tokio::config()
.with_quic(trillium_quinn::QuicConfig::from_single_cert(&cert_pem, &key_pem))
.run(handler);Implementations§
Source§impl QuicConfig
impl QuicConfig
Sourcepub fn from_single_cert(cert_pem: &[u8], key_pem: &[u8]) -> Self
pub fn from_single_cert(cert_pem: &[u8], key_pem: &[u8]) -> Self
Build a QuicConfig from a single PEM-encoded certificate chain and private key.
Automatically configures ALPN for HTTP/3 (h3). For a custom TLS setup, use
from_rustls_server_config.
Sourcepub fn from_rustls_server_config(tls_config: ServerConfig) -> Self
pub fn from_rustls_server_config(tls_config: ServerConfig) -> Self
Construct from a pre-built rustls::ServerConfig.
Use this when you need a custom TLS setup (client authentication, custom crypto
provider, etc.). HTTP/3 ALPN (h3) is added automatically if not already present.
Sourcepub fn from_quinn_server_config(config: ServerConfig) -> Self
pub fn from_quinn_server_config(config: ServerConfig) -> Self
Construct from a pre-built quinn::ServerConfig.
Use this when you also need to customize quinn transport parameters. The caller is
responsible for configuring ALPN protocols (must include h3 to support HTTP/3).
For custom TLS only, prefer from_rustls_server_config.
Sourcepub fn from_cert_resolver(resolver: Arc<dyn ResolvesServerCert>) -> Self
pub fn from_cert_resolver(resolver: Arc<dyn ResolvesServerCert>) -> Self
Build a QuicConfig from a rustls::server::ResolvesServerCert cert resolver.
Use this to bring your own dynamic certificate source — for example, an ACME integration that rotates certificates over time. The resolver is consulted on every new connection, so renewals take effect immediately without rebuilding the QUIC server config.
If the resolver returns None for a given ClientHello (e.g. before the first
certificate has been obtained), the TLS handshake fails and the connection is rejected.
This makes it safe to bind the endpoint before any certificate is available.
Automatically configures ALPN for HTTP/3 (h3).