mirror of https://github.com/0xERR0R/blocky.git
no fast return since adjustment is needed to set minttl
This commit is contained in:
parent
f28e58c689
commit
5dc3a16a7c
11
util/dns.go
11
util/dns.go
|
@ -129,12 +129,11 @@ func GetAnswerMinTTL(msg *dns.Msg) uint32 {
|
|||
//
|
||||
// If the adjustment is zero, the TTL is not changed.
|
||||
func AdjustAnswerTTL[T TTLInput](msg *dns.Msg, adjustment T) {
|
||||
if adjustmentTTL := ToTTL(adjustment); adjustmentTTL != 0 {
|
||||
minTTL := GetAnswerMinTTL(msg)
|
||||
adjustmentTTL := ToTTL(adjustment)
|
||||
minTTL := GetAnswerMinTTL(msg)
|
||||
|
||||
for _, answer := range msg.Answer {
|
||||
headerTTL := atomic.LoadUint32(&answer.Header().Ttl)
|
||||
atomic.StoreUint32(&answer.Header().Ttl, headerTTL-minTTL+adjustmentTTL)
|
||||
}
|
||||
for _, answer := range msg.Answer {
|
||||
headerTTL := atomic.LoadUint32(&answer.Header().Ttl)
|
||||
atomic.StoreUint32(&answer.Header().Ttl, headerTTL-minTTL+adjustmentTTL)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue