mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-26 23:28:08 +03:00
Merge pull request #202 in DNS/adguard-dns from fix/647 to master
* commit '528c1a72cac331f08de5fdee4538529c70dff1bb': - use 127.0.0.1 as a resolver address when DNS binding address is 0.0.0.0 - app: don't print filter update error messages on first launch before DNS server is set up
This commit is contained in:
commit
8e6f7be5b8
3 changed files with 14 additions and 2 deletions
6
dns.go
6
dns.go
|
@ -50,7 +50,11 @@ func generateServerConfig() dnsforward.ServerConfig {
|
|||
FilteringConfig: config.DNS.FilteringConfig,
|
||||
Filters: filters,
|
||||
}
|
||||
newconfig.ResolverAddress = fmt.Sprintf("%s:%d", config.DNS.BindHost, config.DNS.Port)
|
||||
bindhost := config.DNS.BindHost
|
||||
if config.DNS.BindHost == "0.0.0.0" {
|
||||
bindhost = "127.0.0.1"
|
||||
}
|
||||
newconfig.ResolverAddress = fmt.Sprintf("%s:%d", bindhost, config.DNS.Port)
|
||||
|
||||
if config.TLS.Enabled {
|
||||
newconfig.TLSConfig = config.TLS.TLSConfig
|
||||
|
|
|
@ -178,6 +178,10 @@ func periodicallyRefreshFilters() {
|
|||
func refreshFiltersIfNecessary(force bool) int {
|
||||
var updateFilters []filter
|
||||
|
||||
if config.firstRun {
|
||||
return 0
|
||||
}
|
||||
|
||||
config.RLock()
|
||||
for i := range config.Filters {
|
||||
f := &config.Filters[i] // otherwise we will be operating on a copy
|
||||
|
|
|
@ -323,7 +323,11 @@ func customDialContext(ctx context.Context, network, addr string) (net.Conn, err
|
|||
return con, err
|
||||
}
|
||||
|
||||
resolverAddr := fmt.Sprintf("%s:%d", config.DNS.BindHost, config.DNS.Port)
|
||||
bindhost := config.DNS.BindHost
|
||||
if config.DNS.BindHost == "0.0.0.0" {
|
||||
bindhost = "127.0.0.1"
|
||||
}
|
||||
resolverAddr := fmt.Sprintf("%s:%d", bindhost, config.DNS.Port)
|
||||
r := upstream.NewResolver(resolverAddr, 30*time.Second)
|
||||
addrs, e := r.LookupIPAddr(ctx, host)
|
||||
log.Tracef("LookupIPAddr: %s: %v", host, addrs)
|
||||
|
|
Loading…
Reference in a new issue