Pull request 2174: 6820 Warn local ptrs

Squashed commit of the following:

commit c2319658a49eb750c9c362632697c481ff560c71
Merge: c6162a211 bcd143068
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Thu Mar 14 18:10:20 2024 +0300

    Merge branch 'master' into 6820-warn-local-ptrs

commit c6162a211b96e220271383bd8c84e87ad44ba7f8
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Wed Mar 13 19:35:20 2024 +0300

    dnsforward: fix doc

commit c6cce9644e629a085f3b66cac503e9de0bc9b753
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Wed Mar 13 19:19:49 2024 +0300

    all: fix private conf fail on start

commit c11fc3e7abcd4f592d44a3c163b554017eb305a0
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Wed Mar 13 18:43:31 2024 +0300

    WIP
This commit is contained in:
Eugene Burkov
2024-03-14 18:19:27 +03:00
parent bcd1430680
commit 4e3b53f1b7
3 changed files with 54 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ import (
"github.com/AdguardTeam/AdGuardHome/internal/filtering"
"github.com/AdguardTeam/AdGuardHome/internal/querylog"
"github.com/AdguardTeam/AdGuardHome/internal/stats"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/errors"
"github.com/AdguardTeam/golibs/log"
"github.com/AdguardTeam/golibs/netutil"
@@ -157,6 +158,17 @@ func initDNSServer(
}
err = Context.dnsServer.Prepare(dnsConf)
// TODO(e.burkov): Recreate the server with private RDNS disabled. This
// should go away once the private RDNS resolution is moved to the proxy.
var locResErr *dnsforward.LocalResolversError
if errors.As(err, &locResErr) && errors.Is(locResErr.Err, upstream.ErrNoUpstreams) {
log.Info("WARNING: no local resolvers configured while private RDNS " +
"resolution enabled, trying to disable")
dnsConf.UsePrivateRDNS = false
err = Context.dnsServer.Prepare(dnsConf)
}
if err != nil {
return fmt.Errorf("dnsServer.Prepare: %w", err)
}