Skip to main content

Module endpoints

Module endpoints 

Source
Expand description

Multi-endpoint routing for v0.5.17 (dual-slot sessions).

Each wire session can hold up to TWO slots:

  • Federation — on a public relay (default https://wireup.net), listed in the phonebook, reachable across machines.
  • Local — on a loopback relay (default http://127.0.0.1:8771, started with wire relay-server --local-only), invisible from off-box, sub-millisecond round-trip for same-machine sister-Claude traffic.

Both slots are advertised to paired peers via the pair_drop body’s endpoints[] array (additive — v0.5.16-and-earlier peers see only the federation endpoint at the top-level legacy fields, unchanged).

Routing decision lives in cmd_push: walk a peer’s pinned endpoints in priority order (local first if we also have a local slot), POST the event, fall back to the next endpoint on failure. Pulling: the daemon reads from BOTH slots, dedupes by event_id.

Storage shape in relay_state.json is purely additive:

{
  "self": {
    "relay_url": "https://wireup.net",     // legacy federation pointer
    "slot_id":   "abc...",
    "slot_token":"...",
    "endpoints": [                          // v0.5.17 additive
      {"relay_url": "https://wireup.net",     "slot_id": "abc...",  "slot_token": "...", "scope": "federation"},
      {"relay_url": "http://127.0.0.1:8771",  "slot_id": "loop...", "slot_token": "...", "scope": "local"}
    ]
  },
  "peers": {
    "wire-mesh": {
      "relay_url": "https://wireup.net",   // legacy back-compat
      "slot_id":   "...",
      "slot_token":"...",
      "endpoints": [...]                    // v0.5.17 additive
    }
  }
}

Structs§

Endpoint
One reachable address for a wire identity. Includes the bearer slot_token because endpoints flow through the pair_drop body, which is encrypted at protocol level (signed envelope + bilateral pin gate from v0.5.14). Token is the slot’s bearer credential; it MUST stay private to the pair and is never published in the agent card or phonebook.

Enums§

EndpointScope
Where this endpoint sits in the reachability graph.

Functions§

peer_endpoints_in_priority_order
Read all of a peer’s pinned endpoints from relay_state.json, sorted in routing priority order:
pin_peer_endpoints
Pin a peer’s full set of endpoints into relay_state.json under peers[handle]. Preserves the v0.5.16-and-earlier relay_url / slot_id / slot_token top-level fields (pointing at the federation endpoint) so older code paths and back-compat readers don’t break. The new endpoints array is additive.
self_endpoints
All of OUR own endpoints from relay_state.json. Used by cmd_push to find the local slot when routing local-first, and by the daemon’s pull loop to iterate every slot we should be reading from.