Expand description
zapd — the ZAP router, as a library every ZAP process embeds.
There is no daemon. A process that speaks ZAP calls embed and
Node::join: the first makes it a candidate for this user’s router (the
kernel lock in elect picks exactly one), the second gives it a seat on
whichever process won. When the router’s process exits, another candidate
takes over and every node reconnects on its own.
Modules: frame (the envelope), id (node ids), router (registry +
route + presence),
elect (the lock and the doors), door (the browser’s WebSocket), pair
(the browser’s key), node (a process’s own seat). HIP-1334 is the design.
Re-exports§
pub use frame::Descriptor;pub use frame::Entry;pub use id::host;
Modules§
- frame
- The ZAP router envelope — compact binary, schema-agnostic. Not capnp, not
JSON. zapd parses only this envelope; it never parses a
.zappayload schema (browser, payments, identity, PQ channel) — those ride insidepayloadas opaque bytes and are an end-to-end concern between peers. - id
- Node ids:
<kind>/<host>/<name>. - pair
- Pairing — the one secret a browser must prove it holds before the door admits it, and that the router must prove back before the browser trusts it.
Structs§
Functions§
- block_
on - Run a node call to completion from synchronous code (a Python thread, a CLI).
- embed
- Join the election in the background and return at once. The first call in a process starts one thread with its own runtime, so a host needs no async runtime of its own and no knowledge of ours; later calls are no-ops.
- runtime_
dir $XDG_RUNTIME_DIR/zap, else~/.zap/run(macOS has no runtime dir).- socket_
path - The UDS every local node connects to.