feat: DNS host selection - fix code review issues (HAN-400) (#19)
CI / test (push) Failing after 1m58s

This commit was merged in pull request #19.
This commit is contained in:
2026-06-08 03:25:37 +00:00
parent 93959c9f11
commit d6063eb636
6 changed files with 321 additions and 32 deletions
+20 -9
View File
@@ -28,15 +28,18 @@ type Config struct {
AllRootServers bool
RootAAAA bool
FollowAAAA bool
UDPSize int
AllowTCP bool
AlwaysTCP bool
MaxDepth int
Retries int
Fast bool
Verbose bool
Debug int
Quiet bool
// DNSUpstream is the upstream resolver used for root server discovery.
// Format: "host:port" (e.g. "8.8.8.8:53"). Empty means use the system resolver.
DNSUpstream string
UDPSize int
AllowTCP bool
AlwaysTCP bool
MaxDepth int
Retries int
Fast bool
Verbose bool
Debug int
Quiet bool
ShowProgress bool
ShowResolves bool
@@ -127,6 +130,12 @@ func (c *Config) Validate() error {
return ErrAlwaysTCPRequiresTCP
}
if c.DNSUpstream != "" {
if _, _, err := net.SplitHostPort(c.DNSUpstream); err != nil {
return fmt.Errorf("--dns-upstream %q is not a valid host:port address", c.DNSUpstream)
}
}
return nil
}
@@ -173,6 +182,7 @@ func PrintUsage() {
{"--all-root-servers", "Use all 13 root servers"},
{"--root-aaaa", "Include IPv6 root addresses"},
{"--follow-aaaa", "Only follow AAAA for referrals"},
{"--dns-upstream", "Upstream resolver for root discovery (default: system)"},
},
"Transport Options": {
{"--udp-size", "EDNS0 buffer size (default 2048)"},
@@ -220,6 +230,7 @@ func DefaultConfig() *Config {
AllRootServers: false,
RootAAAA: false,
FollowAAAA: false,
DNSUpstream: "",
UDPSize: 2048,
AllowTCP: true,
AlwaysTCP: false,