Switch back to infra-dns for DNS lookups
infra-dns now configured with Charter DNS servers. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -145,11 +145,20 @@ func (c *Crawler) StartMaintenanceLoop() {
|
||||
}
|
||||
}
|
||||
|
||||
// dnsResolver uses local caching DNS (infra-dns)
|
||||
var dnsResolver = &net.Resolver{
|
||||
PreferGo: true,
|
||||
Dial: func(ctx context.Context, network, address string) (net.Conn, error) {
|
||||
d := net.Dialer{Timeout: 5 * time.Second}
|
||||
return d.DialContext(ctx, "udp", "infra-dns:53")
|
||||
},
|
||||
}
|
||||
|
||||
// domainCheck performs a DNS lookup to check if a domain resolves
|
||||
func (c *Crawler) domainCheck(host string) error {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
_, err := net.DefaultResolver.LookupHost(ctx, host)
|
||||
_, err := dnsResolver.LookupHost(ctx, host)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user