You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(client): implement FastStart for quick connection, background resolver discovery and scoring, autonomous multi-resolver pool lifecycle. - #205
When configured with large resolver lists (e.g. 50–100+ endpoints), the client previously blocked session initialization and local proxy (SOCKS5/DNS) startup until 100% of all resolvers were synchronously probed for MTU.
This pull request implements an autonomous multi-resolver domain and path pool lifecycle architecture for MasterDnsVPN. It evolves the client from static resolver rotation to an event-driven, authoritative ResolverPool with rate-limited background discovery, pipelined micro-burst qualification, and asynchronous ranked persistence.
Key Architectural Components
Authoritative ResolverPool:
Manages candidate lifecycle across 4 distinct states: Checking, Active, Standby, and Ineligible.
Enforces a unified 15% replacement margin before displacing an incumbent active path.
Asynchronous ResolverDiscoveryEngine:
Discovers and validates candidate resolvers in the background without blocking foreground tunnel traffic.
Paced by a token-bucket BackgroundQueryLimiter to strictly enforce background query budgets (default: 15 QPS burst, 15 QPS sustained).
Micro-Burst Throughput & MTU Qualification:
Pipelined UDP probe trains measure true transit latency, loss ratios, and MTU envelopes.
Detects upstream rate-limiting and burst drops before admitting candidates to the active pool.
Asynchronous Ranked Persistence Writer:
Saves ranked resolver list snapshots to disk in the background.
Employs coalesce delay and a 30-second MinWriteInterval to prevent disk thrashing during traffic bursts, while guaranteeing immediate flushes on shutdown.
Live Telemetry & Shared Path Evaluation:
Introduces composite scoring that unifies latency and packet loss.
Live loss tracking even when auto-disable is disabled, ensuring dynamic scoring accurately reflects degraded paths.
Acceptance & Benchmark Evidence
Verified via TestIntegratedResolverManagerAcceptance:
Readiness Time ($T_{ready}$): ~20 ms (immediate tunnel availability via fast-start candidates).
Minimizes startup time (no need to scan the entire resolvers list), allows to have several hundreds of resolvers in the list without sacrificing connection time.
@masterking32 these precious times are passing by and the complete internet blackout resistance projects were not developed since filternet came back. i hope you do not abandon this project.
Apply resolver capacity limits after MTU burst qualification
internal/client/balancer.go:1379
This cap also applies during ApplyMTUProbeResult, before burst qualification. RunInitialMTUTests then qualifies only ActiveConnections(), excluding MTU-passing candidates placed on standby here. With MAX_ACTIVE_RESOLVERS=1 and FastStart disabled, a low-latency but rate-limited resolver can exclude a usable alternative, fail the burst test, and prevent startup despite a full MTU scan. Keep all MTU-passing candidates eligible for qualification, and apply the capacity limit after burst ranking.
Limit test parallelism to make cancellation assertions deterministic
internal/client/fast_start_test.go:90
The default MTUTestParallelism=16 allows all ten mock resolvers to run at once. All ten can commit successful results before cancellation is observed, making the later activeCount < 10 assertion fail under valid scheduling. Set parallelism to two so reaching the target necessarily leaves some endpoints untested.
Timestamp MTU responses while the packet train is sent
internal/client/micro_burst.go:184
Responses are read only after the entire paced send loop finishes, so this timestamp includes time already-arrived packets spent queued locally. With 32 packets spaced 2 ms apart, an immediate reply to the first query is measured roughly 62 ms late. These inflated round-trip times seed the balancer and affect ranking and promotion. Receive and timestamp responses while sending the train, synchronizing access to the per-query timing state.
Use monotonic traffic totals for periodic report gating
internal/client/runtime_stats.go:247
calculateTotalSentPackets sums adaptive scoring counters, not monotonic traffic totals: connectionStats.applyHalfLife halves them above 1,000 observations, and health rechecks can reseed them. After a decrease, this comparison suppresses periodic reports until the previous high-water mark is exceeded, potentially indefinitely despite ongoing traffic. Use a monotonic traffic counter or an interval activity flag for this gate instead of the decaying statistics.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical pool-admission and qualification flaws can cause startup failure despite healthy candidates, and an unterminated managed block can cause permanent loss of user configuration during auto-save.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Unresolved critical defects in resolver qualification and pool management can discard healthy connections, admit failing endpoints, and cause startup failures or persistent disconnections.
I reviewed the latest head, including the earlier feedback and the final fork merge.
Many earlier issues are fixed in the main startup and health-check paths: cancellation, endpoint diversity, burst failure handling, standby recovery, file safety, user edits, and stats handling.
However, the final merge adds a separate background discovery path that bypasses those fixes:
background_discovery.go activates MTU results without burst qualification or checking leases, and ignores the shared query budget. In a loopback test, it replaced a healthy active path with one that received 0/4 burst responses, even with both burst settings enabled.
Newly detected local endpoints are never registered in the pool. The update calls return false for unknown keys, but the code still logs them as verified.
Scan mode reports that new endpoints were saved, while the ranked-file writer filters them out because they are absent from the user section. Please keep that protection for automatic ranking and give explicit scan apply a separate way to add new entries.
The scanner only checks Domains[0]. I reproduced a case where normal startup works through the second domain, but the scanner finds no healthy resolvers.
Please also remove the fork-only changes from the final merge: deleted translations, fork branding, fork-v release defaults, and the upstream-sync workflow.
The existing tests, builds, vet, and client/config race tests passed. Three added loopback regression tests reproduced issues 1, 3, and 4 twice. The integration test should also cover Client. Run, default-enabled background discovery, and session resets.
I would keep this in draft until these issues are fixed.
Hi, @masterking32
Thank you for the review.
The merge was accidental and introduced all 4 bugs you mentioned above. I rolled it back.
I am finishing my internal tests and code reviews before I submit this PR for your review again. I'm sorry for wasting your Copilot tokens earlier, I try to do a better testing job this time.
I'll notify you when this PR will be ready.
…ver CLI aliases
- Support auto-saving ranked resolvers, configurable micro-burst parameters, and auto-disable timeout settings.
- Add CLI flag aliases (-c, -l, -v) to server binary.
- Ensure UDP server session cleanup is initialized on creation.
- Align multi-lingual READMEs with canonical domain terminology (Active Paths, preferred path, Tunnel Paths).
- Document testing infrastructure and test acceptance standards in TEST_INFRA.md and TEST_READY.md.
- Update sample client configuration with ranked auto-save and micro-burst tuning parameters.
- Add ignore patterns for local scratch and agent artifacts in .gitignore.
taskkillstar
changed the title
feat(client): implement FastStart for early connection and background resolver discovery
feat(client): implement FastStart for quick connection, background resolver discovery and scoring, autonomous multi-resolver pool lifecycle.
Nov 8, 2026
As this pull request matured, it addressed the underlying architectural requirements of resolver pool lifecycle, background rate-limited discovery, and persistent caching beyond the initial FastStart prototype.
To make the final review straightforward, I have:
Squashed and organized the 42 iterative review commits into 4 clean, logically grouped commits (Config/CLI, Core Pool & Discovery Engine, Test Suites, and Documentation).
Updated the PR title and description to reflect the full architectural scope and included acceptance benchmark metrics.
Verified that all review feedback has been addressed with 100% passing test suites and zero linter warnings.
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
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.
Summary
When configured with large resolver lists (e.g. 50–100+ endpoints), the client previously blocked session initialization and local proxy (SOCKS5/DNS) startup until 100% of all resolvers were synchronously probed for MTU.
This pull request implements an autonomous multi-resolver domain and path pool lifecycle architecture for MasterDnsVPN. It evolves the client from static resolver rotation to an event-driven, authoritative
ResolverPoolwith rate-limited background discovery, pipelined micro-burst qualification, and asynchronous ranked persistence.Key Architectural Components
Authoritative
ResolverPool:Checking,Active,Standby, andIneligible.Asynchronous
ResolverDiscoveryEngine:BackgroundQueryLimiterto strictly enforce background query budgets (default: 15 QPS burst, 15 QPS sustained).Micro-Burst Throughput & MTU Qualification:
Asynchronous Ranked Persistence Writer:
MinWriteIntervalto prevent disk thrashing during traffic bursts, while guaranteeing immediate flushes on shutdown.Live Telemetry & Shared Path Evaluation:
Acceptance & Benchmark Evidence
Verified via
TestIntegratedResolverManagerAcceptance:Verification
go test ./...passes across all packages.