- Rewrite README.md with overview, features, installation (go install +
build from source), quick start, full CLI flag reference table,
output section descriptions, project structure, and development guide
- Add package-level doc comments to all five internal packages:
config, dns, fingerprint, output, traverse (via doc.go or existing
package-declaration files)
- Add GoDoc comments on every exported type, constant, function, and
method across all packages:
- internal/config: Config struct fields, all Parse*/Default/Validate
- internal/dns: QueryConfig, Resolver, BasicResolver, CachingResolver,
ExchangeFunc, RootServer, RootDiscoveryConfig, DecodedResponse,
ResponseClassification, all exported helpers
- internal/fingerprint: Fingerprinter, New, NewWithTimeout, Query,
FingerprintAll
- internal/traverse: Traverser, TraverserConfig, TraversalResult,
Referral, ResolutionState, Response, ResponseType, InfoCache,
Stack, TraverserHooks, EventStage, TraversalEvent, EventHandler,
CircularReferralError, UnresolvableNameserverError
- internal/output: Format, Config, Formatter, SummaryStats,
NewFormatter, AttachHooks, RunTraversal, DefaultConfig,
ComputeSummary
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
co-authored by
Copilot
multica-agent
parent
fe1afe2a97
commit
9aa85d8e5d
+19
-2
@@ -10,12 +10,18 @@ import (
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
// RootServer holds the name and IP addresses of a DNS root nameserver.
|
||||
type RootServer struct {
|
||||
// Name is the FQDN of the root nameserver (e.g. "a.root-servers.net.").
|
||||
Name string
|
||||
// IPv4 holds the IPv4 addresses for the server.
|
||||
IPv4 []net.IP
|
||||
// IPv6 holds the IPv6 addresses for the server.
|
||||
IPv6 []net.IP
|
||||
}
|
||||
|
||||
// AllIPs returns all IP addresses for the server.
|
||||
// When includeAAAA is false, only IPv4 addresses are returned.
|
||||
func (rs *RootServer) AllIPs(includeAAAA bool) []net.IP {
|
||||
var ips []net.IP
|
||||
ips = append(ips, rs.IPv4...)
|
||||
@@ -25,12 +31,19 @@ func (rs *RootServer) AllIPs(includeAAAA bool) []net.IP {
|
||||
return ips
|
||||
}
|
||||
|
||||
// RootDiscoveryConfig controls how DiscoverRoots selects root servers.
|
||||
type RootDiscoveryConfig struct {
|
||||
Server string
|
||||
AllRoots bool
|
||||
// Server overrides which root server is used. An empty string means
|
||||
// auto-select the first root server returned by the system resolver.
|
||||
Server string
|
||||
// AllRoots queries all 13 root servers instead of just one.
|
||||
AllRoots bool
|
||||
// IncludeAAAA includes IPv6 addresses of root servers when true.
|
||||
IncludeAAAA bool
|
||||
}
|
||||
|
||||
// DefaultRootDiscoveryConfig returns a RootDiscoveryConfig that auto-selects a
|
||||
// single IPv4-only root server.
|
||||
func DefaultRootDiscoveryConfig() *RootDiscoveryConfig {
|
||||
return &RootDiscoveryConfig{
|
||||
AllRoots: false,
|
||||
@@ -38,6 +51,10 @@ func DefaultRootDiscoveryConfig() *RootDiscoveryConfig {
|
||||
}
|
||||
}
|
||||
|
||||
// DiscoverRoots discovers DNS root servers to use as traversal starting points.
|
||||
// When cfg.Server is set, that specific root server is used.
|
||||
// When cfg.AllRoots is true, all 13 root servers are returned.
|
||||
// Otherwise, a single root server is selected from the system resolver's NS response.
|
||||
func DiscoverRoots(ctx context.Context, cfg *RootDiscoveryConfig) ([]RootServer, error) {
|
||||
if cfg == nil {
|
||||
cfg = DefaultRootDiscoveryConfig()
|
||||
|
||||
Reference in New Issue
Block a user