Pull request 1961: 6106-fix-dns-filter
Updates #6106. Squashed commit of the following: commit e06ae2195c9231901dda76b7afc00f45021ee369 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Aug 15 14:13:15 2023 +0300 dnsforward: add docs commit c9d77fa04b4d358593e492a9abdca94053ace631 Author: Stanislav Chzhen <s.chzhen@adguard.com> Date: Tue Aug 15 14:02:32 2023 +0300 dnsforward: fix dns filter
This commit is contained in:
parent
85e87b9c1d
commit
887c48cee8
|
@ -667,7 +667,8 @@ func (s *Server) parseUpstreamLine(
|
||||||
PreferIPv6: opts.PreferIPv6,
|
PreferIPv6: opts.PreferIPv6,
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.dnsFilter.EtcHosts != nil {
|
// dnsFilter can be nil during application update.
|
||||||
|
if s.dnsFilter != nil && s.dnsFilter.EtcHosts != nil {
|
||||||
resolved := s.resolveUpstreamHost(extractUpstreamHost(upstreamAddr))
|
resolved := s.resolveUpstreamHost(extractUpstreamHost(upstreamAddr))
|
||||||
sortNetIPAddrs(resolved, opts.PreferIPv6)
|
sortNetIPAddrs(resolved, opts.PreferIPv6)
|
||||||
opts.ServerIPAddrs = resolved
|
opts.ServerIPAddrs = resolved
|
||||||
|
|
|
@ -94,7 +94,8 @@ func (s *Server) prepareUpstreamConfig(
|
||||||
uc.Upstreams = defaultUpstreamConfig.Upstreams
|
uc.Upstreams = defaultUpstreamConfig.Upstreams
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.dnsFilter.EtcHosts != nil {
|
// dnsFilter can be nil during application update.
|
||||||
|
if s.dnsFilter != nil && s.dnsFilter.EtcHosts != nil {
|
||||||
err = s.replaceUpstreamsWithHosts(uc, opts)
|
err = s.replaceUpstreamsWithHosts(uc, opts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("resolving upstreams with hosts: %w", err)
|
return nil, fmt.Errorf("resolving upstreams with hosts: %w", err)
|
||||||
|
|
Loading…
Reference in New Issue