Skip to content

v0.2.1: Resolve both connection endpoints via DNS + local cache#2

Merged
ibehren1 merged 2 commits into
mainfrom
v0.2.1
Jun 25, 2026
Merged

v0.2.1: Resolve both connection endpoints via DNS + local cache#2
ibehren1 merged 2 commits into
mainfrom
v0.2.1

Conversation

@ibehren1

Copy link
Copy Markdown
Owner

Summary

v0.2.1 — fix connection endpoint resolution so both source and destination resolve on the WAN and LAN sub-tabs, using DNS only.

The problem

Both endpoints were already passed through the resolver, but resolution relied on reverse DNS (PTR), and private LAN addresses typically have no public PTR record. So the LAN tab showed only raw IPs, and WAN sources stayed numeric — it looked like the source column wasn't resolving.

The fix

Resolution is now pure reverse-DNS with a program-local cache — no static names table, no hosts file:

  • Resolver looks every address (local or public) up through the system resolver and caches the result in its in-memory map, so each IP is resolved at most once. On a router whose local DNS serves PTR records for its DHCP leases, private addresses resolve through DNS like any other.
  • Resolver takes an injectable lookup callable (defaults to the real system PTR lookup). This exists only so the synthetic --demo mode can stand in a fake DNS backend for its fictional addresses — it is not a static map.
  • The app injects the demo backend only under --demo; production uses real DNS.

Notes

  • Version bumped to 0.2.1.
  • An earlier interim commit on this branch seeded a static names map; that approach was reverted in favor of DNS-only resolution (the map was always in-memory and never touched /etc/hosts, but seeding names is the wrong model regardless).
  • Connections screenshot regenerated.
  • Verified: real DNS path resolves a public IP via the system resolver; demo path resolves both endpoints on both tabs; unknown IPs cache as themselves; tab navigation and the runtime resolve toggle pass.

ibehren1 added 2 commits June 25, 2026 12:11
Both source and destination were already passed through the resolver,
but private LAN addresses have no public PTR record, so the LAN tab
showed only raw IPs and WAN sources stayed numeric.

- Resolver gains a static_names map (IP -> name), checked before PTR,
  like /etc/hosts; seeds the cache so local hosts display a name
- Demo seeds friendly names for its synthetic LAN hosts and router so
  both endpoints resolve on both tabs
- App passes the demo static names when building the resolver (both at
  startup and on the runtime 'r' toggle)
- Bump version to 0.2.1; regenerate connections screenshot
Replace the static_names seeding (wrong model) with a pure reverse-DNS
resolver: every address, local or public, is looked up through the
system resolver and the result cached in the program-local map. On a
router whose local DNS serves PTR for DHCP leases, private addresses
resolve through DNS like any other.

- Resolver takes an injectable 'lookup' callable (defaults to the real
  system PTR lookup); no static table
- Demo provides demo_ptr_lookup() as a fake DNS backend for its
  synthetic addresses, exercising the same cache/queue path
- App injects the demo backend only in --demo mode

The static map never touched /etc/hosts (it was in-memory), but seeding
names is the wrong approach regardless — DNS is the source of truth.
@ibehren1 ibehren1 self-assigned this Jun 25, 2026
@ibehren1
ibehren1 merged commit 855a284 into main Jun 25, 2026
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