Skip to content

feat(p2p): support offline LAN forwarder discovery, admission, and manual host entry - #263

Merged
iwismer merged 3 commits into
mainfrom
feat/lan-forwarder-discovery
Oct 26, 2026
Merged

iwismer merged 3 commits into
mainfrom
feat/lan-forwarder-discovery

Conversation

@iwismer

@iwismer iwismer commented Oct 26, 2026

Copy link
Copy Markdown
Owner

Summary

Enables the receiver to discover and connect to forwarders directly over a local network (Ethernet or Wi-Fi) without internet or server connectivity, while working seamlessly alongside an existing server configuration:

  • LAN Auto-Admission (services/forwarder, crates/rt-iroh):
    • Inspects Connection::paths() via rt_iroh::is_lan_connection so incoming direct private/link-local IP connections are automatically admitted when p2p.allow_lan_receivers is enabled (default true), even when server_url is configured and even if the receiver's EndpointId is not on the server allow-list.
    • Marks LAN-admitted connections as exempt from server AllowList::apply_update revocations while continuing to enforce the server/cached allow-list for relay and public-IP connections.
    • Defaults allowlist_cache_path to a p2p-allowlist.cache sibling of secret_key_path and moves first-boot device-token minting into the background server task so an offline server does not block P2P startup.
  • LAN Auto-Discovery & Status Probe (crates/rt-iroh, services/forwarder, services/receiver):
    • Adds UDP broadcast/multicast LAN discovery (spawn_forwarder_lan_beacon on UDP 7448 and spawn_receiver_lan_listener on UDP 7449) advertising endpoint_id, bound P2P port, local interface IPs, and display_name.
    • Exposes display_name, p2p_endpoint_id, p2p_listen_port, and p2p_direct_addrs on /api/v1/status and adds optional string display_name = 3 to StreamCatalog in proto/p2p.proto.
    • Adds add_forwarder_by_host to probe http://<host>/api/v1/status by IP or .local hostname, persist discovered peers in the receiver's known_forwarders SQLite table, and periodically refresh manual host addresses.
  • Unified Forwarder Map & Dynamic Multipath Updates (crates/rt-iroh, services/receiver, apps/receiver-ui):
    • Merges server catalog, LAN beacon discovery, and manual host probes into a single endpoint_id-keyed discovered_forwarders map without duplicate entries, ordering LAN addresses ahead of WAN addresses.
    • Mounts iroh::address_lookup::memory::MemoryLookup on rt_iroh::Endpoint and pushes newly discovered direct_addrs into active ForwarderConnection workers so iroh's multipath selector prefers direct LAN paths and falls back to relay/internet paths automatically.
    • Adds a Connect Local IP / .local host form in ConnectionsTab.svelte and updates getOverallHealth() to report healthy when local forwarders are connected without a server configured.

Verification

  • cargo test --workspace --lib
  • cargo test -p receiver -p receiver-tauri -p forwarder -p rt-iroh -p rt-p2p-protocol -p rt-test-utils -- --test-threads=4
  • cd apps/receiver-ui && npm test && npm run check && npm run lint
  • uv run scripts/e2e/run_stack.py (69/69 checks passed)

Written and posted by AI on behalf of Isaac.

@iwismer
iwismer merged commit 096f161 into main Oct 26, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant