Skip to main content

Crate tachyon_quic

Crate tachyon_quic 

Source
Expand description

An implementation of the h3::quic traits for s2n-quic.

This crate provides the binding between s2n-quic and h3 (HTTP/3 implementation). Wrap an accepted or connected s2n_quic::Connection in Connection and hand it to h3; everything else is h3’s own API.

§Example

use bytes::Bytes;
use tachyon_quic::{s2n_quic::Server, Connection};

let mut quic_server = Server::builder()
    .with_tls((cert, key))?
    .with_io("127.0.0.1:443")?
    .start()?;

while let Some(conn) = quic_server.accept().await {
    tokio::spawn(async move {
        // `h3` needs to know which buffer type response bodies are sent as;
        // it cannot be inferred from the connection alone.
        let mut h3_conn =
            tachyon_quic::h3::server::Connection::<_, Bytes>::new(Connection::new(conn)).await?;

        while let Some(resolver) = h3_conn.accept().await? {
            let (_req, mut stream) = resolver.resolve_request().await?;
            // ... handle the request ...
        }

        Ok::<_, Box<dyn std::error::Error + Send + Sync>>(())
    });
}

§Features

  • fips — builds s2n-quic against the FIPS-validated aws-lc module.
  • tracing — emits tracing spans at TRACE level around each trait method.

Neither is enabled by default.

§Limitations

h3::quic::SendStreamUnframed is not implemented, so the parts of h3 that require unframed writes — its AsyncWrite adapters and h3-webtransport — cannot be used with this backend. Everything reachable through h3::client and h3::server works. The gap surfaces as an unsatisfied trait bound at compile time, not as a runtime failure.

s2n-quic cannot carry the HTTP/3 reason phrase in CONNECTION_CLOSE, so quic::OpenStreams::close sends the error code and drops the reason.

Re-exports§

pub use h3;
pub use s2n_quic;

Structs§

BidiStream
A bidirectional QUIC stream.
Connection
A QUIC connection wrapper that implements h3::quic::Connection.
OpenStreams
A handle to open streams on a connection.
RecvStream
A receive QUIC stream.
SendStream
A send QUIC stream.