all: fix initial rdns check

This commit is contained in:
Eugene Burkov 2024-05-22 12:40:30 +03:00
parent bcda80bee7
commit 5eaa024b11
2 changed files with 7 additions and 9 deletions

View File

@ -103,21 +103,19 @@ func newPrivateConfig(
} }
} }
log.Debug("dnsforward: upstreams to resolve ptr for local addresses: %v", addrs) log.Debug("dnsforward: private-use upstreams: %v", addrs)
uc, err = proxy.ParseUpstreamsConfig(addrs, opts) uc, err = proxy.ParseUpstreamsConfig(addrs, opts)
if err != nil { if err != nil {
return uc, fmt.Errorf("preparing private upstreams: %w", err) return uc, fmt.Errorf("preparing private upstreams: %w", err)
} }
if !confNeedsFiltering { if confNeedsFiltering {
return uc, nil
}
err = filterOutAddrs(uc, unwanted) err = filterOutAddrs(uc, unwanted)
if err != nil { if err != nil {
return uc, fmt.Errorf("filtering private upstreams: %w", err) return uc, fmt.Errorf("filtering private upstreams: %w", err)
} }
}
// Prevalidate the config to catch the exact error before creating proxy. // Prevalidate the config to catch the exact error before creating proxy.
// See TODO on [PrivateRDNSError]. // See TODO on [PrivateRDNSError].

View File

@ -156,7 +156,7 @@ func initDNSServer(
} }
// Try to prepare the server with disabled private RDNS resolution if it // Try to prepare the server with disabled private RDNS resolution if it
// failed to prepare as is. See TODO on [ErrBadPrivateRDNSUpstreams]. // failed to prepare as is. See TODO on [dnsforward.PrivateRDNSError].
err = Context.dnsServer.Prepare(dnsConf) err = Context.dnsServer.Prepare(dnsConf)
if privRDNSErr := (&dnsforward.PrivateRDNSError{}); errors.As(err, &privRDNSErr) { if privRDNSErr := (&dnsforward.PrivateRDNSError{}); errors.As(err, &privRDNSErr) {
log.Info("WARNING: %s; trying to disable private RDNS resolution", err) log.Info("WARNING: %s; trying to disable private RDNS resolution", err)