DoH: only use the optional IP to bootstrap resolution

Fixes #100
This commit is contained in:
Frank Denis 2018-03-21 09:32:35 +01:00
parent 577ac5c91a
commit d2805a19e4
2 changed files with 10 additions and 0 deletions

View File

@ -89,6 +89,9 @@ func (proxy *Proxy) StartProxy() {
liveServers, err := proxy.serversInfo.refresh(proxy)
if liveServers > 0 {
dlog.Noticef("dnscrypt-proxy is ready - live servers: %d", liveServers)
if !proxy.xTransport.ignoreSystemDNS {
proxy.xTransport.clearCache()
}
SystemDNotify()
} else if err != nil {
dlog.Error(err)

View File

@ -51,6 +51,13 @@ func NewXTransport(timeout time.Duration, useIPv4 bool, useIPv6 bool) *XTranspor
return &xTransport
}
func (xTransport *XTransport) clearCache() {
xTransport.cachedIPs.Lock()
xTransport.cachedIPs.cache = make(map[string]string)
xTransport.cachedIPs.Unlock()
dlog.Info("IP cache cleared")
}
func (xTransport *XTransport) rebuildTransport() {
dlog.Debug("Rebuilding transport")
if xTransport.transport != nil {