-(dnsforward): custom client per-domain upstreams

Closes: https://github.com/AdguardTeam/AdGuardHome/issues/1539
This commit is contained in:
Andrey Meshkov
2020-05-13 20:31:43 +03:00
parent 1f954ab673
commit 67a39045fc
10 changed files with 106 additions and 88 deletions

View File

@@ -11,7 +11,6 @@ import (
"github.com/AdguardTeam/AdGuardHome/stats"
"github.com/AdguardTeam/AdGuardHome/util"
"github.com/AdguardTeam/dnsproxy/proxy"
"github.com/AdguardTeam/dnsproxy/upstream"
"github.com/AdguardTeam/golibs/log"
"github.com/joomcode/errorx"
)
@@ -176,7 +175,7 @@ func generateServerConfig() dnsforward.ServerConfig {
newconfig.TLSAllowUnencryptedDOH = tlsConf.AllowUnencryptedDOH
newconfig.FilterHandler = applyAdditionalFiltering
newconfig.GetUpstreamsByClient = getUpstreamsByClient
newconfig.GetCustomUpstreamByClient = Context.clients.FindUpstreams
return newconfig
}
@@ -222,10 +221,6 @@ func getDNSAddresses() []string {
return dnsAddresses
}
func getUpstreamsByClient(clientAddr string) []upstream.Upstream {
return Context.clients.FindUpstreams(clientAddr)
}
// If a client has his own settings, apply them
func applyAdditionalFiltering(clientAddr string, setts *dnsfilter.RequestFilteringSettings) {
Context.dnsFilter.ApplyBlockedServices(setts, nil, true)