Repository navigation
feat(airc): learn a peer's live IP from authenticated inbound dials (#9) - #1275
Merged
Merged
Conversation
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)
peer_id. Thread the source addr through and report it via a genericon_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.peer_id → real_ipinto an in-sessionlearned_ipsmap (shared across daemon clones likedial_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 expectedpeer_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_candidatespairs 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