Pull request: use mathutil
Merge in DNS/adguard-home from use-mathutil to master Squashed commit of the following: commit cfe2c02a7bb727e81fcd91674aa777df37413a8e Author: Eugene Burkov <E.Burkov@AdGuard.COM> Date: Tue Jan 24 18:12:32 2023 +0300 all: use mathutil
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
|
||||
"github.com/AdguardTeam/dnsproxy/proxy"
|
||||
"github.com/AdguardTeam/golibs/log"
|
||||
"github.com/AdguardTeam/golibs/mathutil"
|
||||
"github.com/AdguardTeam/golibs/netutil"
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
@@ -335,15 +336,10 @@ func (s *Server) synthRR(rr dns.RR, soaTTL uint32) (result dns.RR) {
|
||||
Name: aResp.Hdr.Name,
|
||||
Rrtype: dns.TypeAAAA,
|
||||
Class: aResp.Hdr.Class,
|
||||
Ttl: mathutil.Min(aResp.Hdr.Ttl, soaTTL),
|
||||
},
|
||||
AAAA: s.mapDNS64(addr),
|
||||
}
|
||||
|
||||
if rrTTL := aResp.Hdr.Ttl; rrTTL < soaTTL {
|
||||
aaaa.Hdr.Ttl = rrTTL
|
||||
} else {
|
||||
aaaa.Hdr.Ttl = soaTTL
|
||||
}
|
||||
|
||||
return aaaa
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user