1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2025-01-17 02:46:54 +01:00

Round TTLs

This commit is contained in:
Frank Denis 2021-09-23 19:10:40 +02:00
parent 34f0caaa34
commit a4684d3bf5

View File

@ -196,6 +196,9 @@ func updateTTL(msg *dns.Msg, expiration time.Time) {
ttl := uint32(0)
if until > 0 {
ttl = uint32(until / time.Second)
if until-time.Duration(ttl)*time.Second < until/2 {
ttl += 1
}
}
for _, rr := range msg.Answer {
rr.Header().Ttl = ttl