1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-27 00:12:31 +01:00

Use SystemResolverTTL as a minimum timeout for cached resolver IPs

This commit is contained in:
Frank Denis 2019-11-01 21:47:13 +01:00
parent 97e4c44223
commit 3db3de0a91

View File

@ -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