passcod_web_transport_quinn/lib.rs
1//! WebTransport is a protocol for client-server communication over QUIC.
2//! It's [available in the browser](https://caniuse.com/webtransport) as an alternative to HTTP and WebSockets.
3//!
4//! WebTransport is layered on top of HTTP/3 which is then layered on top of QUIC.
5//! This library hides that detail and tries to expose only the QUIC API, delegating as much as possible to the underlying implementation.
6//! See the [Quinn documentation](https://docs.rs/quinn/latest/quinn/) for more documentation.
7//!
8//! QUIC provides two primary APIs:
9//!
10//! # Streams
11//! QUIC streams are ordered, reliable, flow-controlled, and optionally bidirectional.
12//! Both endpoints can create and close streams (including an error code) with no overhead.
13//! You can think of them as TCP connections, but shared over a single QUIC connection.
14//!
15//! # Datagrams
16//! QUIC datagrams are unordered, unreliable, and not flow-controlled.
17//! Both endpoints can send datagrams below the MTU size (~1.2kb minimum) and they might arrive out of order or not at all.
18//! They are basically UDP packets, except they are encrypted and congestion controlled.
19//!
20//! # Limitations
21//! WebTransport is able to be pooled with HTTP/3 and multiple WebTransport sessions.
22//! This crate avoids that complexity, doing the bare minimum to support a single WebTransport session that owns the entire QUIC connection.
23//! If you want to support HTTP/3 on the same host/port, you should use another crate (ex. `h3-webtransport`).
24//! If you want to support multiple WebTransport sessions over the same QUIC connection... you should just dial a new QUIC connection instead.
25
26// External
27mod client;
28mod error;
29mod provider;
30mod recv;
31mod send;
32mod server;
33mod session;
34
35pub use client::*;
36pub use error::*;
37pub(crate) use provider::*;
38pub use recv::*;
39pub use send::*;
40pub use server::*;
41pub use session::*;
42
43// Internal
44mod connect;
45mod settings;
46
47use connect::*;
48use settings::*;
49
50/// The HTTP/3 ALPN is required when negotiating a QUIC connection.
51pub const ALPN: &[u8] = b"h3";
52
53/// Re-export the underlying QUIC implementation.
54pub use quinn;