Skip to content

feat(airc): learn a peer's live IP from authenticated inbound dials (#9) - #1275

Merged
joelteply merged 2 commits into
canaryfrom
feat/airc-learn-live-address
Jun 21, 2026
Merged

joelteply merged 2 commits into
canaryfrom
feat/airc-learn-live-address

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Completes the recover/heal/route-around series. The robustness layer on top of #8 (stable port) + #10 (prune ghosts): when a peer whose published endpoint went stale (moved networks, pre-#8 record) can't be reached at its advertised address, recover by learning its real address from the fact that it connected to us.

How — no security change (no pin loosening)

  • transport: the LAN adapter's inbound accept path already authenticates the client cert → peer_id. Thread the source addr through and report it via a generic on_inbound(peer_id, source_ip) observer. The pipe stays dumb — "this enrolled peer connected from this IP." Only the IP is surfaced (the source port is the peer's ephemeral outbound port, not its listener), so transport stays a generic pipe.
  • airc-lib: register an observer that records peer_id → real_ip into an in-session learned_ips map (shared across daemon clones like dial_quarantine; re-learned each session, no persistence). The dial path prepends (learned_ip, advertised_port) as a preferred candidate — the learned IP is known-reachable, the port is stable under fix(connect): stale-pidfile cleanup wedged by pipefail + dead parent (#6) #8 — so a peer that moved IPs is dialable again before paying timeouts on the stale rungs. The outbound dial still pins to the expected peer_id (TLS unchanged).

On a LAN, reachability is symmetric: if X reached us, we can reach X back at that IP. Generic transport + smarts in the layer above (the airc↔continuum boundary).

Tests

learned_lan_candidates pairs the learned IP with advertised ports and adds nothing when it already matches a stored endpoint; all 30 transport tests + the discovery/lan suites green. (Disk-full linker failures during dev were an environment issue — 39G of stale cargo-target dirs reclaimed — not a code problem.)

Series complete: #1257 self-heal · #8 stable port · #10 prune ghosts · #1269 self-update · #9 learn-live-address.

🤖 Generated with Claude Code

joelteply and others added 2 commits June 20, 2026 19:01
The robustness layer on top of #8 (stable port) + #10 (prune ghosts): when a
peer whose PUBLISHED endpoint went stale (moved networks, pre-#8 record) can't
be reached at its advertised address, recover by LEARNING its real address
from the fact that it connected to US.

How (no security change — no pin loosening):
- transport: the LAN adapter's inbound accept path already authenticates the
  client cert → peer_id. Thread the source addr through and, via a generic
  `on_inbound(peer_id, source_ip)` observer, report it. The pipe stays dumb —
  it just says "this enrolled peer connected from this IP"; only the IP is
  surfaced (the source PORT is the peer's ephemeral outbound port, not its
  listener).
- airc-lib: register an observer that records peer_id -> real_ip into an
  in-session `learned_ips` map (shared across daemon clones like
  dial_quarantine; re-learned each session, no persistence). The dial path
  prepends `(learned_ip, advertised_port)` as a PREFERRED candidate — the
  learned IP is known-reachable, and the port is stable under #8, so a peer
  that moved IPs is dialable again before paying timeouts on the stale rungs.
  The outbound dial still pins to the expected peer_id (TLS unchanged).

On a LAN reachability is symmetric: if X reached us, we can reach X back at
that IP. Generic transport + the smarts in the layer above ([[airc-vs-
continuum-layer-boundary]]).

Tests: learned_lan_candidates pairs the learned IP with advertised ports and
adds nothing when it already matches a stored endpoint; all 30 transport
tests + discovery/lan suites green.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
The branch-protection clippy (deny warnings) check (now required) caught a
clone-on-ref-slice in the new learned_lan_candidates test. Borrow via
std::slice::from_ref instead of `&[stale.clone()]`. No behavior change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@joelteply
joelteply merged commit 7e9a486 into canary Jun 21, 2026
11 of 12 checks passed
@joelteply
joelteply deleted the feat/airc-learn-live-address branch June 21, 2026 00:12
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