// NewDNSResolverImpl constructs a new DNS resolver object that utilizes the // provided list of DNS servers for resolution. func NewDNSResolverImpl(readTimeout time.Duration, servers []string, stats metrics.Scope) *DNSResolverImpl { dnsClient := new(dns.Client) // Set timeout for underlying net.Conn dnsClient.ReadTimeout = readTimeout dnsClient.Net = "tcp" return &DNSResolverImpl{ DNSClient: dnsClient, Servers: servers, allowRestrictedAddresses: false, stats: stats, txtStats: stats.NewScope("TXT"), aStats: stats.NewScope("A"), caaStats: stats.NewScope("CAA"), mxStats: stats.NewScope("MX"), } }
// NewDNSResolverImpl constructs a new DNS resolver object that utilizes the // provided list of DNS servers for resolution. func NewDNSResolverImpl(readTimeout time.Duration, servers []string, stats metrics.Scope, clk clock.Clock, maxTries int) *DNSResolverImpl { // TODO(jmhodges): make constructor use an Option func pattern dnsClient := new(dns.Client) // Set timeout for underlying net.Conn dnsClient.ReadTimeout = readTimeout dnsClient.Net = "tcp" return &DNSResolverImpl{ DNSClient: dnsClient, Servers: servers, allowRestrictedAddresses: false, maxTries: maxTries, clk: clk, stats: stats, txtStats: stats.NewScope("TXT"), aStats: stats.NewScope("A"), caaStats: stats.NewScope("CAA"), mxStats: stats.NewScope("MX"), } }