Expand description
iroh-http-core — Iroh QUIC endpoint, HTTP/1.1 via hyper, fetch and serve.
This crate owns the Iroh endpoint and wires HTTP/1.1 framing to QUIC streams via hyper. Nothing in here knows about JavaScript.
Per epic #182 the crate is split into two top-level modules with a one-way dependency:
- [
http] — pure-Rust HTTP-over-iroh primitives. Nou64handles, no callbacks. A pure-Rust application can callhttp::client::fetch_requestandhttp::server::servewithout touching any FFI type. - [
ffi] — FFI bridge: handle store, callback-shaped serve, flat fetch. Wraps [http]; never imported in the reverse direction (enforced bytests/architecture.rs).
Re-exports§
pub use endpoint::parse_direct_addrs;pub use endpoint::ConnectionEvent;pub use endpoint::DiscoveryOptions;pub use endpoint::EndpointStats;pub use endpoint::IrohEndpoint;pub use endpoint::NetworkingOptions;pub use endpoint::NodeAddrInfo;pub use endpoint::NodeOptions;pub use endpoint::PathInfo;pub use endpoint::PeerStats;pub use endpoint::PoolOptions;pub use endpoint::StreamingOptions;pub use events::TransportEvent;pub use registry::get_endpoint;pub use registry::insert_endpoint;pub use registry::remove_endpoint;
Modules§
Structs§
- Body
- Single HTTP body type used everywhere in
iroh-http-core. - Body
Reader - Consumer end — stored in the reader registry.
Uses
tokio::sync::Mutexso we can.awaitthe receiver without holding the registry’sstd::sync::Mutex. - Close
Info - Close information returned when a session ends.
- Compression
Options - Compression options for response bodies (server) and outgoing requests (client; reserved).
- Core
Error - Structured error returned by core functions.
- FfiDuplex
Stream - Handles for the two sides of a full-duplex QUIC stream.
- FfiResponse
- Flat response-head struct that crosses the FFI boundary.
- Handle
Store - Per-endpoint handle registry. Owns all body readers, writers,
sessions, request-head rendezvous channels, and fetch-cancel tokens for
a single
IrohEndpoint. - Parsed
Node Addr - Parsed node address from a ticket string, bare node ID, or JSON address info.
- Remote
Node Id - Authenticated peer node id of the QUIC connection a request arrived
on. Inserted as a request extension by the per-connection
tower_http::add_extension::AddExtensionLayerinserve_with_events. - Request
Payload - Options passed to the JS serve callback per incoming request.
- Response
Head Entry - Serve
Handle - Serve
Options - Options for the HTTP serve loop.
- Session
- A QUIC session to a single remote peer.
- Stack
Config - Tower stack configuration shared by [
build_stack] and [build_client_stack]. - Store
Config - Configuration for a
HandleStore. Set once at endpoint bind time.
Enums§
- Error
Code - Machine-readable error codes for the FFI boundary.
- Fetch
Error - Typed error returned by the pure-Rust
fetch_requestAPI.
Constants§
- ALPN
- ALPN for the HTTP/1.1-over-QUIC protocol (version 2 wire format).
- ALPN_
DUPLEX - ALPN for base + bidirectional streaming sessions.
- ALPN_
DUPLEX_ STR - String form of
ALPN_DUPLEX, for use inNodeOptions::capabilities. - ALPN_
STR - String form of
ALPN, for use inNodeOptions::capabilities. - KNOWN_
ALPNS - All recognised ALPN capability strings.
Functions§
- base32_
encode - Encode bytes as lowercase RFC 4648 base32 (no padding).
- fetch
- FFI-shaped fetch — re-exported as
iroh_http_core::fetchfor FFI binary compatibility (Slice D acceptance #5). Composition mirrors the pre-Slice-D function exactly; the moving parts that became pure Rust live incrate::http::client::fetch_request. - fetch_
request - Pure-Rust outbound entry — the canonical client API.
- ffi_
serve - Back-compat 3-arg FFI serve entry: equivalent to
ffi_serve_with_callbackwithon_connection_event = None. The Node / Deno / Tauri adapters call this directly. - ffi_
serve_ with_ callback - FFI-shaped serve entry. Constructs an [
IrohHttpService] around the supplied callback and delegates to the pure-Rustcrate::http::server::serve_with_events. - generate_
secret_ key - Generate a fresh Ed25519 secret key. Returns 32 raw bytes, or
Errif the RNG panics. - make_
body_ channel - Create a matched (writer, reader) pair backed by a bounded mpsc channel.
- node_
ticket - Generate a ticket string for the given endpoint.
- parse_
node_ addr - Parse a string that may be a bare node ID, a ticket string (JSON-encoded
NodeAddrInfo), or a JSON object withidandaddrsfields. - public_
key_ verify - Verify a 64-byte Ed25519 signature against a 32-byte public key.
Returns
trueon success,falseon any failure (including panics). - respond
- Send the response head for a request handle previously delivered to JS
via the
RequestPayload::req_handlecallback. - secret_
key_ sign - Sign arbitrary bytes with a 32-byte Ed25519 secret key.
Returns a 64-byte signature, or
Errif the underlying crypto panics. - serve
- Pure-Rust serve entry — convenience 3-arg wrapper that omits the
connection-event callback. Equivalent to
serve_with_events(ep, opts, svc, None). - serve_
with_ events - Pure-Rust serve entry — the canonical inbound API.