From 3db3de0a912fc6be7f5784fe9706c69bcb42f4ed Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 1 Nov 2019 21:47:13 +0100 Subject: [PATCH] Use SystemResolverTTL as a minimum timeout for cached resolver IPs --- dnscrypt-proxy/xtransport.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dnscrypt-proxy/xtransport.go b/dnscrypt-proxy/xtransport.go index faaf12c1..dd0dab9f 100644 --- a/dnscrypt-proxy/xtransport.go +++ b/dnscrypt-proxy/xtransport.go @@ -86,8 +86,8 @@ func ParseIP(ipStr string) net.IP { func (xTransport *XTransport) saveCachedIP(host string, ip net.IP, ttl time.Duration) { item := &CachedIPItem{ip: ip, expiration: nil} if ttl >= 0 { - if ttl < xTransport.timeout { - ttl = xTransport.timeout + if ttl < SystemResolverTTL { + ttl = SystemResolverTTL } expiration := time.Now().Add(ttl) item.expiration = &expiration