Skip to content

fix(country): resilient lookups with dns fallback and cache - #30

Merged
Mathious6 merged 2 commits into
mainfrom
fix/country-retry-window
Sep 4, 2026
Merged

Mathious6 merged 2 commits into
mainfrom
fix/country-retry-window

Conversation

@Mathious6

@Mathious6 Mathious6 commented Sep 4, 2026 •

Copy link
Copy Markdown
Owner

What changed

  • src-tauri/src/dns.rs (new): when the system resolver returns unusable answers (0.0.0.0, ::) or fails, the lookup falls back to a direct DNS-over-UDP A query against public resolvers (std only, no new dependencies) and pins the resolved IP on the ureq agent. Resolutions are cached for 5 minutes.
  • country.rs: wider retry window (4 rounds × 3 attempts, 500 ms in-round spacing, 1s/2s/4s between rounds ≈ 14 s of coverage) so multi-second network flaps no longer exhaust the budget.
  • commands.rs / +page.svelte: the pre-probe lookup result is pushed to the UI through a countries-refreshed event, so refreshed countries appear as soon as the run starts.

Why

The machine's VPN resolver intermittently answers 0.0.0.0 / :: for the country lookup service. Connections to those addresses fail with ConnectionRefused (Os error 61 — confirmed by in-app traces), so subnets could stay stuck without a country until a later probe happened to hit a good window.

Validation

  • cargo fmt --check, cargo clippy --locked --all-targets -- -D warnings, cargo test --locked --lib (88 tests, +7)
  • #[ignore] live lookup test of the previously stuck subnets
  • End-to-end manual verification: real probe triggered in the app, countries landed at run start and persisted across restart
  • bun run check, bun run build
  • GITHUB_REF_NAME=v0.4.2 sh scripts/check-version.sh

@Mathious6 Mathious6 changed the title fix(country): widen retry window and refill after probes fix(country): resilient lookups with dns fallback and cache Sep 4, 2026
Lookup failures through the flaky VPN resolver left subnets without a
country: the system resolver intermittently answers 0.0.0.0/:: for the
lookup service, so every connection attempt is refused. Requests now
retry across a ~14s window and fall back to a direct DNS-over-UDP query
against public resolvers when the system answer is unusable. The
resolved countries are pushed to the ui as soon as the run starts.
@Mathious6
Mathious6 force-pushed the fix/country-retry-window branch from aa06981 to 20baa52 Compare September 4, 2026 14:36
@Mathious6
Mathious6 merged commit 2560126 into main Sep 4, 2026
7 checks passed
@Mathious6
Mathious6 deleted the fix/country-retry-window branch September 4, 2026 14:44
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