Skip to main content

Module quinn_transport

Module quinn_transport 

Source
Expand description

Quinn WebTransport RPC plane — moq M1 (#151).

A second backend for the transport-generic RPC core (see super::rpc_session), proving the RPC plane is transport-pluggable: the exact same Cap’n Proto bidi wire protocol, DoS bounds, graceful-drain, and error-envelope semantics run over quinn’s [web_transport_quinn::Session] instead of iroh’s.

Unlike the iroh substrate (which terminates raw QUIC bidi streams under a custom ALPN), web-transport-quinn speaks the full WebTransport handshake (HTTP/3 CONNECT, ALPN h3). The wire framing inside each bidi stream is identical, so the generic core is reused unchanged.

Structs§

QuinnRpcServer
A quinn-backed WebTransport server for the RPC plane.
QuinnTransport
Wraps a quinn [web_transport_quinn::Session] as a Transport for RPC plane traffic. Delegates to the transport-generic SessionRpcTransport.

Traits§

NinePWtHandler
Serves one 9P session over a WebTransport bidi stream (H1b / #765).
NinePWtStream
A WebTransport bidi stream carrying a 9P2000.L session, erased to a byte stream. The H1b /9p arm hands one of these to the injected NinePWtHandler; the handler runs the transport-agnostic Translator::serve_connection core over it (the same core H1a’s WebSocket pump feeds). Blanket-implemented for any AsyncRead + AsyncWrite byte stream (a joined WT send/recv pair).

Functions§

cert_sha256
SHA-256 fingerprint of a DER-encoded certificate, as 32 raw bytes — the cert-hash pin used in QuicServerAuth, the DID-doc #quic entry, and the StreamInfo.reach Quic option (#274). The fingerprint is public material.
connect_pinned
Convenience: pin by the full server cert DER (hashes it for you). Used by tests and callers that hold the cert rather than its fingerprint.
connect_pinned_hashes
Build a quinn WebTransport client session against a self-signed server, accepting the leaf cert if its SHA-256 fingerprint is any of cert_hashes (QuicServerAuth::accept_cert_hashes — a set so rotation can overlap). Hermetic: dials an IP-literal URL so no DNS lookup or network egress occurs.
connect_pinned_hashes_path
Build a quinn WebTransport client session against a self-signed server at an explicit URL path (e.g. /moq for the moq plane vs / for RPC), accepting the leaf cert if its SHA-256 is any of cert_hashes. Hermetic: dials an IP-literal URL so no DNS lookup occurs. Mirrors connect_pinned_hashes but lets the caller select the path the server path-dispatches on (#274).
connect_pinned_hashes_path_with_headers
connect_pinned_hashes_path variant that attaches extra HTTP/3 CONNECT headers to the WebTransport request — used by #1153 to carry the Authorization: Bearer <jwt> credential the /moq endpoint verifies at CONNECT time. Hermetic: dials an IP-literal URL.
connect_webpki
Build a quinn WebTransport client session against a server with a CA-issued certificate, validated via the system root store and the DNS server_name (QuicServerAuth::web_pki). Dials https://{server_name}:{port}/.
connect_webpki_path
WebPKI variant of connect_pinned_hashes_path: validate via the system root store + DNS server_name, dialing the given URL path (#274).
global_moq_connect_authz
The process-global /moq CONNECT authenticator, if one has been registered.
global_ninep_handler
The process-global 9P WebTransport handler, if one has been registered.
set_global_moq_connect_authz
Register the process-global /moq CONNECT authenticator (idempotent, first-wins). The hyprstream crate calls this at startup with an [MoqConnectAuthz] built over its PolicyManager subject→tenant map.
set_global_ninep_handler
Register the process-global 9P WebTransport handler (idempotent, first-wins). Returns true if this call installed it, false if one was already set.
verify_peer_cert_pinned
Verify the peer’s leaf-cert SHA-256 is one of accept — the post-connect pin check for the WebPKI+pin mode (CA validation runs in the handshake; this adds the pin on top). Call immediately after connect, before any RPC. The cert fingerprint is public, so a plain comparison is fine (no secret to leak).

Type Aliases§

QuinnPendingStream
Re-export the generic stubs under quinn-flavoured names.
QuinnPublishStub