Expand description
Shared device-session server (C-5): transport-neutral /econ-v1/device-session/1.
Carriers implement SessionStreams + HostBus and call serve or
serve_with_registry. Pass WebRtcSignaling when the carrier can
answer webrtc.signal/1; otherwise that method is refused with
unsupported_transport.
The shared WebRTC answerer lives in webrtc: wire a webrtc::WebRtcAnswerer
with a carrier-specific webrtc::WebRtcCarrier (STUN, portmap, clock,
session bind). Iroh/p2p-only pieces (QUIC ProtocolHandler,
gossip STUN discovery adapters) stay in the carrier apps. Live-session
revalidation is shared here via SessionRegistry.
Re-exports§
pub use webrtc::ByteBudget;pub use webrtc::MapRefusal;pub use webrtc::MappedSessionPort;pub use webrtc::NoSessionPortMapper;pub use webrtc::NullWebRtcCarrier;pub use webrtc::SessionPortMapper;pub use webrtc::StaticWebRtcCarrier;pub use webrtc::WebRtcAnswerer;pub use webrtc::WebRtcCarrier;pub use webrtc::WebRtcHandle;pub use webrtc::SESSION_BYTES;
Modules§
- caps
- Capability names the host bus is expected to map.
- webrtc
- Transport-independent WebRTC answerer for
webrtc.signal/1.
Structs§
- Ingress
Socket - Host-owned Unix socket that alone may attest device-session provenance.
- OpenOk
- Proven session identity after a successful
session.open/1. - Refusal
- A host refusal the device is allowed to see (
code+ public detail). - Revalidate
Report - Result of one
SessionRegistry::revalidatepass. - Serve
Options - Optional knobs for
serve_with_options. - Session
- Verified (or renewed) session identity returned by the host bus.
- Session
Registry - Registry of live full-mode device sessions for periodic revalidation.
- Wire
Socket - Node wire socket that
wire/1streams splice onto (ADR-310).
Enums§
- Frame
Error - Errors from encoding/decoding a request frame.
- Open
Mode - Session mode after a successful open.
- Response
Error - Errors from decoding a response frame.
- Session
End - Why
crate::servereturned. - Session
Path - How the session reached the node (stamped on the ingress).
Constants§
- ALPN
- ALPN for
/econ-v1/device-session/1. - DEFAULT_
WIRE_ SOCKET - Default path of the node’s trusted wire socket (ADR-310).
- DEVICE_
CALL_ METHOD - A device calls a node service.
- HTTP_
REQUEST_ METHOD - One HTTP request on an authenticated session stream.
- MAX_
FRAME_ BYTES - Maximum size of a single wire frame.
- MAX_
PREAMBLE - Node-side cap on the preamble line, newline included (ADR-310 Amendment 1).
- PATH_
HEADER - Path header stamped on every attested upstream request.
- RESPONSE_
STATUS_ ERR - Response status: error.
- RESPONSE_
STATUS_ OK - Response status: success.
- REVOKED_
CLOSE_ CODE - Application close code when revalidation (or explicit revoke) tears a session down.
- SESSION_
HEADER - Provenance header stamped on every attested upstream request.
- SESSION_
OPEN_ METHOD - First stream:
{credential}or{mode:renewal}. - SESSION_
RENEW_ METHOD - One-shot first stream:
{}→ a new credential, then connection close. - SUPERSEDED_
CLOSE_ CODE - Application close code when a newer session supersedes an older one.
- WEBRTC_
SIGNAL_ METHOD - WebRTC signaling on an authenticated session stream.
- WIRE_
METHOD - Node-wire splice on an authenticated session stream / DataChannel.
- WS_
STREAM_ METHOD - A live WebSocket bridge on an authenticated session stream.
Traits§
- HostBus
- The app’s bus to the host for device-session capabilities.
- Session
Streams - One authenticated peer connection (handshake already proved
Self::peer_key). - WebRtc
Signaling - Carrier-owned WebRTC signaling for
webrtc.signal/1.
Functions§
- decode_
request - Decode a request frame, borrowing the payload.
- decode_
response - Decode a response frame.
- encode_
http_ tunnel_ request - Encode an
http.request/1body for tests and carriers. - encode_
request - Encode
[u16 BE method_len][method][payload]. - encode_
response - Encode
[u8 status][body]. - is_
definitive_ refusal_ code - Exact-match check: only these codes close a live session.
- peek_
method - Read only the method prefix; payload stays unread.
- preamble_
line - The one-line preamble the node trusts on the wire socket.
- serve
- Serve one authenticated peer connection until it ends.
- serve_
with_ options - Like
serve, with optional registry and wire socket viaServeOptions. - serve_
with_ registry - Like
serve, but registers a successful full-mode open inregistry(for once-a-minute revalidation) and removes it when this call returns. - splice_
to_ wire_ socket - Connect to
wire_socket, write the preamble, splicerecv/sendboth ways. - verify_
refusal_ code - Pull a known verify refusal code out of a host error string, if (and only if) it is one of the six codes the host’s refusal shape carries.
- wire_
socket_ path - Resolve the wire socket path:
NODE_WIRE_SOCKETwhen set, else the default.
Type Aliases§
- BoxRecv
- Boxed read half of one bidirectional stream.
- BoxSend
- Boxed write half of one bidirectional stream.
- Session
Close - Closes the underlying
crate::SessionStreamsconnection.