feat: support recursive query from authoritive servers#113
Closed
taoso wants to merge 4 commits intonatesales:mainfrom
Closed
feat: support recursive query from authoritive servers#113taoso wants to merge 4 commits intonatesales:mainfrom
taoso wants to merge 4 commits intonatesales:mainfrom
Conversation
5fe1c65 to
809012e
Compare
natesales
requested changes
Sep 18, 2025
Owner
natesales
left a comment
There was a problem hiding this comment.
So sorry for the late review here and thanks for the PR!
| return fmt.Errorf("Only query one type in recursive mode") | ||
| } | ||
|
|
||
| opts.Timeout = 10 * time.Minute // FIXME(tao) |
Owner
There was a problem hiding this comment.
The underlying DNS transport has it's own timeout, but this overrides the flag if configured
Contributor
Author
There was a problem hiding this comment.
The default timeout is 10s, which may be too short for recursive query.
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.
Hi @natesales
Please review this PR.
I propose to add recursive query support to q for the convenience for dns debugging or learning.
A new option
--recursivehas been introduced to enable the recursive mode.In this mode, q will first query the root server hints from iana.org via https protocol. And then, it will choose whether to use the A or AAAA address of the first root servers, and do the query recursively. Besides, we can also use the
-4option to force use the ipv4 address.After each round of query, q will choose the first A/AAAA record from extra fields as the server for next round. The query loop will continue until q get some answers. This PR choose the first NS server for stable output, other chosen algorithm maybe adopted.
As the authoritative servers for parent zone will only respond response with authority and extra fields, I choose to enable the
--traceoption for recursive mode, so that there is no need to add extra logic to display the information of the authoritative servers.Please give your comments. Thank you.
Here is one usage example