Skip to main content

Crate web_transport_iroh

Crate web_transport_iroh 

Source
Expand description

WebTransport is a protocol for client-server communication over QUIC.

It’s available in the browser as an alternative to HTTP and WebSockets.

WebTransport is layered on top of HTTP/3 which is then layered on top of QUIC.

This crate implements the web-transport-trait session and stream traits for iroh connections and streams. A web-transport-iroh session can either use an iroh connection directly, or run HTTP/3 over the iroh connection. The latter includes the WebTransport request-response handshake, through which a request target and headers can be set.

§Limitations

WebTransport is able to be pooled with HTTP/3 and multiple WebTransport sessions. This crate avoids that complexity, doing the bare minimum to support a single WebTransport session that owns the entire QUIC connection. If you want to support multiple WebTransport sessions over the same QUIC connection… you should just dial a new QUIC connection instead.

Re-exports§

pub use http;
pub use iroh;
pub use web_transport_trait as generic;

Structs§

Client
A client for connecting to an iroh WebTransport endpoint.
ClosedStream
An error indicating the stream was already closed.
Connected
An established HTTP/3 CONNECT session with both request and response.
Connecting
An in-progress HTTP/3 CONNECT handshake, awaiting a response.
H3Request
An H3 WebTransport handshake, SETTINGS exchanged and CONNECT accepted, awaiting server decision (respond OK / reject).
H3SessionAccept
QuicRequest
A QUIC-only WebTransport handshake, awaiting server decision.
RecvStream
A stream that can be used to receive bytes. See iroh::endpoint::RecvStream.
SendStream
A stream that can be used to send bytes. See iroh::endpoint::SendStream.
Session
An established WebTransport session, acting like a full QUIC connection. See iroh::endpoint::Connection.
Settings
Maintains the HTTP/3 control stream by holding references to the send/recv streams.

Enums§

ClientError
An error returned when connecting to a WebTransport endpoint.
ConnectError
An error during the HTTP/3 CONNECT handshake.
ReadError
An error when reading from crate::RecvStream. Similar to iroh::endpoint::ReadError.
ReadExactError
An error returned by crate::RecvStream::read_exact. Similar to iroh::endpoint::ReadExactError.
ReadToEndError
An error returned by crate::RecvStream::read_to_end. Similar to iroh::endpoint::ReadToEndError.
ServerError
An error returned when receiving a new WebTransport session.
SessionError
An error returned by crate::Session, split between underlying QUIC errors and WebTransport errors.
SettingsError
An error during the HTTP/3 SETTINGS frame exchange.
WebTransportError
An error that can occur when reading/writing the WebTransport stream header.
WriteError
An error when writing to crate::SendStream. Similar to iroh::endpoint::WriteError.

Constants§

ALPN_H3
The HTTP/3 ALPN is required when negotiating a QUIC connection.