mirror of
https://github.com/DNSCrypt/dnscrypt-proxy.git
synced 2025-04-06 06:37:36 +03:00
Round TTLs
This commit is contained in:
parent
34f0caaa34
commit
a4684d3bf5
1 changed files with 3 additions and 0 deletions
|
@ -196,6 +196,9 @@ func updateTTL(msg *dns.Msg, expiration time.Time) {
|
||||||
ttl := uint32(0)
|
ttl := uint32(0)
|
||||||
if until > 0 {
|
if until > 0 {
|
||||||
ttl = uint32(until / time.Second)
|
ttl = uint32(until / time.Second)
|
||||||
|
if until-time.Duration(ttl)*time.Second < until/2 {
|
||||||
|
ttl += 1
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, rr := range msg.Answer {
|
for _, rr := range msg.Answer {
|
||||||
rr.Header().Ttl = ttl
|
rr.Header().Ttl = ttl
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue