Skip to main content

web_transport_iroh/
lib.rs

1//! WebTransport is a protocol for client-server communication over QUIC.
2//!
3//! It's [available in the browser](https://caniuse.com/webtransport) as an
4//! alternative to HTTP and WebSockets.
5//!
6//! WebTransport is layered on top of HTTP/3 which is then layered on top of QUIC.
7//!
8//! This crate implements the [web-transport-trait] session and stream traits for iroh [connections] and streams.
9//! A web-transport-iroh session can either use an iroh connection directly, or run HTTP/3 over the iroh connection.
10//! The latter includes the WebTransport request-response handshake, through which a request target and headers can
11//! be set.
12//!
13//! # Limitations
14//!
15//! WebTransport is able to be pooled with HTTP/3 and multiple WebTransport sessions.
16//! This crate avoids that complexity, doing the bare minimum to support a single
17//! WebTransport session that owns the entire QUIC connection.
18//! If you want to support multiple WebTransport sessions over the same QUIC connection...
19//! you should just dial a new QUIC connection instead.
20//!
21//! [web-transport-trait]: https://docs.rs/web-transport-trait/latest/web_transport_trait/
22//! [iroh documentation]: https://docs.rs/iroh/latest/iroh/
23//! [connections]: https://docs.rs/iroh/latest/iroh/endpoint/struct.Connection.html
24
25mod client;
26mod connect;
27mod error;
28mod recv;
29mod send;
30mod server;
31mod session;
32mod settings;
33#[cfg(test)]
34mod tests;
35
36pub use client::*;
37pub use connect::*;
38pub use error::*;
39pub use recv::*;
40pub use send::*;
41pub use server::*;
42pub use session::*;
43pub use settings::*;
44
45/// The HTTP/3 ALPN is required when negotiating a QUIC connection.
46pub const ALPN_H3: &str = "h3";
47
48/// Re-export the http crate because it's in the public API.
49pub use http;
50/// Re-export iroh.
51pub use iroh;
52/// Re-export the generic WebTransport implementation.
53pub use web_transport_trait as generic;