diff --git a/crawler.go b/crawler.go index 85fa706..4233537 100644 --- a/crawler.go +++ b/crawler.go @@ -145,26 +145,11 @@ func (c *Crawler) StartMaintenanceLoop() { } } -// dnsResolver uses local caching DNS (infra-dns) with fallback to system -var dnsResolver = &net.Resolver{ - PreferGo: true, - Dial: func(ctx context.Context, network, address string) (net.Conn, error) { - d := net.Dialer{Timeout: 2 * time.Second} - // Try local caching DNS first (CoreDNS on proxy network) - conn, err := d.DialContext(ctx, "udp", "infra-dns:53") - if err == nil { - return conn, nil - } - // Fallback to system DNS - return d.DialContext(ctx, network, address) - }, -} - // domainCheck performs a DNS lookup to check if a domain resolves func (c *Crawler) domainCheck(host string) error { - ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - _, err := dnsResolver.LookupHost(ctx, host) + _, err := net.DefaultResolver.LookupHost(ctx, host) return err }