Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(dht): tag LAN-scoped addresses and gate same-WAN sharing#105

Closed
mickvandijke wants to merge 2 commits into
mainfrom
feat/dht-lan-address-type
Closed

feat(dht): tag LAN-scoped addresses and gate same-WAN sharing#105
mickvandijke wants to merge 2 commits into
mainfrom
feat/dht-lan-address-type

Conversation

@mickvandijke

Copy link
Copy Markdown
Collaborator

Summary

  • Adds AddressType::Lan as a new highest-priority address slot so same-LAN peers retain a fast local path alongside their relay/direct/unverified/NATted entries (one extra slot per IP family, capped at 3).
  • Filters LAN-tagged entries on publish, gossip-merge, find-node response, and dial selection so they only reach receivers we believe share our LAN/WAN; rewrites our own LAN IP to loopback for the receiver where appropriate.
  • Drops relay candidates that resolve to our own observed WAN IP (same-NAT hairpin) so dialers fall through to the peer's direct/unverified path.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo test --lib (379 passed)
  • Validate same-LAN dial path on a real two-node setup
  • Validate same-NAT hairpin avoidance on a real two-node setup

🤖 Generated with Claude Code

Introduces an `AddressType::Lan` slot that stores a peer's private,
link-local, or loopback path alongside its existing relay/direct/
unverified/NATted entries. Same-LAN peers can now retain a fast local
path without evicting their WAN path, capped at one extra slot per IP
family. Address publication, gossip merges, find-node responses, and
dial selection all filter LAN-tagged entries down to receivers we
believe share our LAN/WAN, drop relay candidates that resolve to our
own observed WAN IP, and rewrite our own LAN IP to loopback for the
receiver where appropriate.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
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