DNS Lookup: nameserver picker (DoH presets, authoritative, custom via /api/dig) - #2
Closed
chrismuench wants to merge 2 commits into
Closed
DNS Lookup: nameserver picker (DoH presets, authoritative, custom via /api/dig)#2chrismuench wants to merge 2 commits into
chrismuench wants to merge 2 commits into
Conversation
… /api/dig) The Lookup subtab now has a Server dropdown: - Cloudflare / Google / DNS.SB — DoH straight from the browser, as before (the only public resolvers with a CORS-enabled JSON API). - Authoritative — walks up from the query name via NS/SOA to find the zone's nameserver, then queries it directly. - Custom… — any nameserver hostname or IP, like `dig @ns1.example.com`. Browsers can't speak DNS on port 53, so the last two go through a new /api/dig Pages Function that does DNS over TCP via cloudflare:sockets, using a minimal wire-format codec in lib/dnswire.mjs (encode one question; decode answers incl. name compression, A/AAAA/NS/CNAME/SOA/ PTR/MX/TXT/SRV/CAA rdata). Strict input validation, private/reserved nameservers blocked, 64KB cap, 8s timeout, 60s edge cache. Responses match the DoH JSON shape so the frontend rendering is unchanged; a note shows which server answered. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Deploying sysadminstuff with
|
| Latest commit: |
a3dc5a8
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cebe5efa.sysadminstuff.pages.dev |
| Branch Preview URL: | https://dns-nameserver-picker.sysadminstuff.pages.dev |
…ract A custom entry is always queried over classic DNS on TCP/53 (the dig @server contract) — which every major DoH provider also serves. If someone pastes a DoH URL, extract its hostname via hostFromInput; if the host truly only speaks DoH, the error now says so. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
The DNS Lookup subtab gets a Server dropdown so you can choose which nameserver to query:
dig @ns1.example.com.How
Browsers can't speak DNS on port 53, so authoritative/custom queries go through a new
/api/digPages Function that talks real DNS over TCP viacloudflare:sockets(same mechanism as the whois port-43 fallback in #1):lib/dnswire.mjs— minimal, dependency-free DNS wire codec (single-question encode; response decode with name-compression support and rdata formatting for A, AAAA, NS, CNAME, SOA, PTR, MX, TXT, SRV, CAA).{Status, Answer: [{name, type, TTL, data}]}) so the existing record-card rendering works unchanged; a note under the results shows which server answered.isBlockedHost, 64 KB response cap, 8 s timeout, query-ID match check, 60 s edge cache in_middleware.js. No user input is logged.Testing
node tests/smoke.mjs— 268 checks pass (new: wire-codec encode/decode incl. compression pointers, NXDOMAIN, truncation and pointer-loop safety).node tests/e2e.mjsvswrangler pages dev— all 46 checks pass (new: dig via 8.8.8.8, missing/bad params, private-NS rejection)./api/dig: A/MX/TXT/SOA via 8.8.8.8 & 1.1.1.1, authoritativens3.cloudflare.comby hostname, empty answers, and validation errors.🤖 Generated with Claude Code