package resolver import ( "context" "github.com/miekg/dns" ) // ExtractRecordValue exports extractRecordValue for testing. func ExtractRecordValue(rr dns.RR) string { return extractRecordValue(rr) } // CollectAnswerRecords exports collectAnswerRecords for testing. func CollectAnswerRecords(msg *dns.Msg, resp *NameserverResponse) { var state queryState collectAnswerRecords(msg, resp, &state) } // UsableReply exports usableReply for testing. func UsableReply(resp *dns.Msg, zone string, name string) bool { return usableReply(resp, zone, name) } // NSSetFrom exports nsSetFrom for testing. func NSSetFrom(resp *dns.Msg, domain string) []string { return nsSetFrom(resp, domain) } // CollectIPs exports collectIPs for testing. func CollectIPs( results map[string]*NameserverResponse, ) ([]string, string, error) { return collectIPs(results) } // QueryServers exports queryServers for testing. func (r *Resolver) QueryServers( ctx context.Context, servers []string, zone string, name string, qtype uint16, ) (*dns.Msg, error) { return r.queryServers(ctx, servers, zone, name, qtype) } // QueryEachNS exports queryEachNS for testing. func (r *Resolver) QueryEachNS( ctx context.Context, nameservers []string, hostname string, ) (map[string]*NameserverResponse, error) { return r.queryEachNS(ctx, nameservers, hostname, recordTypes()) } // ResolveNSIPs exports resolveNSIPs for testing, looking each name up // as a lookup that no other lookup started. func (r *Resolver) ResolveNSIPs( ctx context.Context, nsNames []string, ) []string { ips, _ := r.resolveNSIPs(ctx, nsNames, 1) return ips } // MaxLookupDepth exports maxLookupDepth for testing. const MaxLookupDepth = maxLookupDepth // QueryZone exports queryZone for testing. func (r *Resolver) QueryZone( ctx context.Context, given []string, withoutAddresses []string, zone string, name string, qtype uint16, depth int, ) (*dns.Msg, error) { return r.queryZone( ctx, given, withoutAddresses, zone, name, qtype, depth, ) } // RootServerList exports rootServerList for testing. func RootServerList() []string { return rootServerList() } // Shuffled exports shuffled for testing. func Shuffled( servers []string, shuffle func(n int, swap func(i, j int)), ) []string { return shuffled(servers, shuffle) }