Skip to main content

Module wire

Module wire 

Source
Expand description

The realtime wire, byte for byte as every Vector client speaks it: base32 topic ids, relay-only node addresses, and the gossip frame trailer.

Re-exports§

pub use crate::webxdc::base32_nopad_decode;
pub use crate::webxdc::base32_nopad_encode;

Constants§

MAX_GOSSIP_MESSAGE
What the gossip layer accepts per message: payload plus trailer, with headroom.
MAX_PAYLOAD
The largest payload an app may send in one frame (the WebXDC limit).
NODE_KEY_LEN
TRAILER_LEN
Every frame ends in a 4-byte little-endian sequence number and the sending node’s key. Gossip dedups by content hash, so the trailer is what keeps two peers’ identical payloads (two “hello“s) from collapsing into one.

Functions§

browser_relay
A relay as a browser can dial it. WebKit refuses a WebSocket to a fully qualified host, and iroh spells its relays with the trailing dot; without it the URL names the same server.
decode_node_addr
A peer-supplied address, reduced to its relay paths: dialling a direct address someone else nominated would hand them our IP. Which relays may be dialled is the mesh’s call (is_default_relay).
decode_topic
A topic id as it rides the webxdc-topic tag: 52 base32 characters.
dialable
A peer’s address as this platform may dial it: only relays every client uses (a peer-named relay would be a server of their choosing that we connect to), spelled as the platform can reach them. Empty when none is left.
encode_node_addr
encode_topic
fallback_topic
The topic for an app whose message carries none: derived from the app’s name (as its manifest gives it) and the message, so every copy agrees.
is_default_relay
Whether a relay is one of iroh’s defaults, the set every Vector client uses. Hosts compare without iroh’s trailing dot.
open_frame
Split an inbound frame into (payload, sender node key). None for a frame too short to carry a trailer.
relay_mode
The relays a node uses: iroh’s defaults, as the platform can dial them.
relay_only
relay_urls
seal_frame
Append the trailer to an outbound payload.