Skip to content

feat(dns): Add real-time DNS speed benchmark and 'Fastest' auto-selection option - #4935

Merged
ChrisTitusTech merged 5 commits into
ChrisTitusTech:mainfrom
MADHACKER85:feat/dns-benchmark
Sep 19, 2026
Merged

ChrisTitusTech merged 5 commits into
ChrisTitusTech:mainfrom
MADHACKER85:feat/dns-benchmark

Conversation

@MADHACKER85

@MADHACKER85 MADHACKER85 commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Fastest to the Tweaks DNS dropdown. WinUtil compares TCP port 53 connection times for explicitly eligible, unfiltered providers (Google and Cloudflare), then applies the quickest measured provider through the existing IPv4/IPv6 and DoH configuration path.

Filtering providers are excluded by default through BenchmarkEligible metadata in config/dns.json. If no probe succeeds, adapter settings are preserved and the DNS step returns failure. Probes dispose their clients on success, timeout, and connection failure.

TCP connection time is a rough latency estimate, not a DNS lookup or DoH benchmark. The two sequential probes have 1500 ms timeouts, so the scan can take about three seconds when both time out.

Review fixes

  • Replaced the incomplete provider-name filter with explicit eligibility metadata.
  • Kept the no-success path free of adapter/registry changes and aligned it with the current DNS setter's boolean result contract.
  • Do not count an EndConnect failure as successful latency.
  • Added regression coverage for provider eligibility, timeouts, connection failures, and Fastest integration.
  • Updated the user guide and configuration contract. The previously added .biomeignore was already removed; this PR introduces no JSON lint exclusions.
  • Merged current main before validation.

Validation

  • Import-Module Pester -RequiredVersion 5.8.0 -Force; Invoke-Pester -Path 'pester/*.Tests.ps1' -Output Detailed -CI: 844 passed, 0 failed, 1 existing UAC-dependent test skipped on Windows / PowerShell 7.
  • Focused pester/dns.Tests.ps1 and pester/dns-benchmark.Tests.ps1: 18 passed in Windows PowerShell 5.1 and PowerShell 7.
  • Invoke-ScriptAnalyzer -Path . -Settings ./lint/PSScriptAnalyser.ps1 -Recurse: no errors; convention/test-stub warnings remain.
  • ./Compile.ps1: passed; generated winutil.ps1 is ignored and not committed.
  • Local Codex review: no actionable findings (compatible CLI model override used).
  • Live read-only TCP benchmark on Windows: Google 24 ms; Cloudflare 42 ms. No adapter DNS settings changed during this check.
  • The setter/DoH integration was exercised with mocked system commands; no live adapter-change or GUI click-through test was performed.

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: cf1be907-ef9e-487e-90c5-39f402794393

📥 Commits

Reviewing files that changed from the base of the PR and between f65d263 and eb8abd6.

📒 Files selected for processing (8)
  • SPEC.md
  • config/dns.json
  • config/tweaks.json
  • docs/src/content/docs/guides/tweaks.mdx
  • functions/private/Get-WinUtilDNSBenchmark.ps1
  • functions/private/Set-WinUtilDNS.ps1
  • pester/dns-benchmark.Tests.ps1
  • pester/dns.Tests.ps1

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Summary

Summary by CodeRabbit

  • New Features

    • Added a Fastest DNS option that benchmarks eligible providers and applies the quickest available choice.
    • Google and Cloudflare are eligible for automatic latency comparisons.
    • Preserves existing DNS settings when no provider responds successfully.
  • Documentation

    • Updated configuration and user guidance to explain provider eligibility, benchmarking, and Fastest DNS behavior.

Walkthrough

Adds the Fastest DNS option. It benchmarks eligible providers over TCP port 53, selects the lowest-latency successful result, updates DNS and DoH settings, and preserves existing settings when no provider succeeds.

Changes

Fastest DNS selection

Layer / File(s) Summary
DNS provider benchmarking
config/dns.json, functions/private/Get-WinUtilDNSBenchmark.ps1, pester/dns-benchmark.Tests.ps1, SPEC.md
Google and Cloudflare opt into benchmarking. Get-WinUtilDNSBenchmark validates timeouts, measures TCP port 53 latency, disposes connections, sorts results, and records failures as 9999 ms.
Fastest DNS provider integration
functions/private/Set-WinUtilDNS.ps1, config/tweaks.json, docs/src/content/docs/guides/tweaks.mdx, pester/dns.Tests.ps1
The selector exposes Fastest. Set-WinUtilDNS applies a successful benchmark result through the existing DNS and DoH path, or returns $false without changing settings when no result qualifies.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant WPFchangedns
  participant SetWinUtilDNS
  participant GetWinUtilDNSBenchmark
  participant DNSProvider
  WPFchangedns->>SetWinUtilDNS: Select Fastest
  SetWinUtilDNS->>GetWinUtilDNSBenchmark: Request latency results
  GetWinUtilDNSBenchmark->>DNSProvider: Probe TCP port 53
  DNSProvider-->>GetWinUtilDNSBenchmark: Return latency or failure
  GetWinUtilDNSBenchmark-->>SetWinUtilDNS: Return sorted results
  SetWinUtilDNS-->>WPFchangedns: Apply provider or return failure
Loading

Suggested labels: new feature

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the main changes: real-time DNS benchmarking and the new Fastest auto-selection option.
Description check ✅ Passed The description directly explains the Fastest DNS option, eligibility rules, failure behavior, tests, documentation updates, and validation results.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot added the new feature New feature or request label Aug 7, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a3df14ad33

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread functions/private/Set-WinUtilDNS.ps1 Outdated
Comment thread functions/private/Set-WinUtilDNS.ps1 Outdated
Comment thread functions/private/Get-WinUtilDNSBenchmark.ps1

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@functions/private/Get-WinUtilDNSBenchmark.ps1`:
- Around line 42-55: Update the TCP probe around the visible $client and
$asyncResult operations to use try/finally cleanup: after a successful wait,
call $asyncResult.EndConnect() and ensure $client is closed or disposed on every
success, timeout, and exception path. Preserve the 9999 fallback latency, and do
not dispose $asyncResult.AsyncWaitHandle.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 16975faa-5874-48d4-93ce-bfa656774f1e

📥 Commits

Reviewing files that changed from the base of the PR and between 8d3adb5 and a3df14a.

📒 Files selected for processing (3)
  • config/tweaks.json
  • functions/private/Get-WinUtilDNSBenchmark.ps1
  • functions/private/Set-WinUtilDNS.ps1

Comment thread functions/private/Get-WinUtilDNSBenchmark.ps1

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.biomeignore:
- Line 4: Remove the broad *.json rule from .biomeignore so JSON files under
docs, including package-lock.json, package.json, and tsconfig.json, remain
included; retain the existing config-specific ignore rules.
- Around line 1-4: Remove the inert .biomeignore file and move its JSON
exclusion patterns into a supported Biome ignore mechanism, preferably the
excludes configuration in biome.json; preserve coverage for config/*.json,
nested config/*.json, and all *.json files.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 14808587-468d-44cb-b543-75eed0159b70

📥 Commits

Reviewing files that changed from the base of the PR and between a3df14a and f2b8e0f.

📒 Files selected for processing (3)
  • .biomeignore
  • functions/private/Get-WinUtilDNSBenchmark.ps1
  • functions/private/Set-WinUtilDNS.ps1
🚧 Files skipped from review as they are similar to previous changes (2)
  • functions/private/Set-WinUtilDNS.ps1
  • functions/private/Get-WinUtilDNSBenchmark.ps1

Comment thread .biomeignore Outdated
Comment thread .biomeignore Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 614cb6b21c

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread functions/private/Get-WinUtilDNSBenchmark.ps1 Outdated
@ChrisTitusTech

Copy link
Copy Markdown
Owner

@codex review

@ChrisTitusTech

Copy link
Copy Markdown
Owner

@coderabbitai full review

@ChrisTitusTech

Copy link
Copy Markdown
Owner

Hosted CodeRabbit completed on eb8abd6 with no actionable comments and a successful status. Its bundled Biome tool reports parse failures on existing multiline PowerShell strings in config/tweaks.json; the PR only adds Fastest to ComboItems in that file. WinUtil compilation and the full Pester suite validate the configuration successfully. No broad lint exclusions were introduced. Local Codex review is also clean; the requested hosted Codex review has not returned yet.

@coderabbitai

coderabbitai Bot commented Sep 19, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Full review finished.

@ChrisTitusTech

Copy link
Copy Markdown
Owner

Final review verification for eb8abd6: CodeRabbit full review cf1be907-ef9e-487e-90c5-39f402794393 covered all eight PR files against current main f65d263 and returned zero actionable comments. Hosted compile and CodeRabbit checks pass; all seven review threads are resolved. Local Codex review is clean. The separately requested hosted Codex review has not responded. GitHub reports MERGEABLE but BLOCKED / REVIEW_REQUIRED because a code-owner approval is still required. No merge performed.

@ChrisTitusTech
ChrisTitusTech merged commit 8e3998d into ChrisTitusTech:main Sep 19, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature New feature or request

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants