Use system DNS resolver instead of custom infra-dns

infra-dns container has UDP connectivity issues to upstream DNS.
System resolver works (proven via wget test).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
primal
2026-02-02 20:55:57 -05:00
parent f2bb1e72d2
commit e6761954c0
+2 -17
View File
@@ -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 // domainCheck performs a DNS lookup to check if a domain resolves
func (c *Crawler) domainCheck(host string) error { 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() defer cancel()
_, err := dnsResolver.LookupHost(ctx, host) _, err := net.DefaultResolver.LookupHost(ctx, host)
return err return err
} }