fix(country): resilient lookups with dns fallback and cache - #30
Merged
Merged
Conversation
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
force-pushed
the
fix/country-retry-window
branch
from
September 4, 2026 14:36
aa06981 to
20baa52
Compare
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.
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 acountries-refreshedevent, 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 withConnectionRefused(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 subnetsbun run check,bun run buildGITHUB_REF_NAME=v0.4.2 sh scripts/check-version.sh