all: sync with master; upd chlog
This commit is contained in:
@@ -333,6 +333,13 @@ func (req *jsonDNSConfig) checkBootstrap() (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
// containsPrivateRDNS returns true if req contains private RDNS settings and
|
||||
// should be validated.
|
||||
func (req *jsonDNSConfig) containsPrivateRDNS() (ok bool) {
|
||||
return (req.UsePrivateRDNS != nil && *req.UsePrivateRDNS) ||
|
||||
(req.LocalPTRUpstreams != nil && len(*req.LocalPTRUpstreams) > 0)
|
||||
}
|
||||
|
||||
// checkPrivateRDNS returns an error if the configuration of the private RDNS is
|
||||
// not valid.
|
||||
func (req *jsonDNSConfig) checkPrivateRDNS(
|
||||
@@ -340,7 +347,7 @@ func (req *jsonDNSConfig) checkPrivateRDNS(
|
||||
sysResolvers SystemResolvers,
|
||||
privateNets netutil.SubnetSet,
|
||||
) (err error) {
|
||||
if (req.UsePrivateRDNS == nil || !*req.UsePrivateRDNS) && req.LocalPTRUpstreams == nil {
|
||||
if !req.containsPrivateRDNS() {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -103,20 +103,18 @@ 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)
|
||||
if err != nil {
|
||||
return uc, fmt.Errorf("preparing private upstreams: %w", err)
|
||||
}
|
||||
|
||||
if !confNeedsFiltering {
|
||||
return uc, nil
|
||||
}
|
||||
|
||||
err = filterOutAddrs(uc, unwanted)
|
||||
if err != nil {
|
||||
return uc, fmt.Errorf("filtering private upstreams: %w", err)
|
||||
if confNeedsFiltering {
|
||||
err = filterOutAddrs(uc, unwanted)
|
||||
if err != nil {
|
||||
return uc, fmt.Errorf("filtering private upstreams: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
// Prevalidate the config to catch the exact error before creating proxy.
|
||||
|
||||
Reference in New Issue
Block a user