all: satisfy staticcheck

This commit is contained in:
Cuong Manh Le
2023-01-20 21:59:52 +07:00
committed by Cuong Manh Le
parent 46965b04b4
commit f6371360bc
4 changed files with 6 additions and 13 deletions

View File

@@ -1,3 +1,4 @@
package main
//lint:ignore U1000 use in os_linux.go
type getDNS func(iface string) []string

View File

@@ -282,11 +282,12 @@ func containRcode(rcodes []int, rcode int) bool {
}
func setCachedAnswerTTL(answer *dns.Msg, now, expiredTime time.Time) {
ttl := uint32(expiredTime.Sub(now).Seconds())
if ttl < 0 {
ttlSecs := expiredTime.Sub(now).Seconds()
if ttlSecs < 0 {
return
}
ttl := uint32(ttlSecs)
for _, rr := range answer.Answer {
rr.Header().Ttl = ttl
}

View File

@@ -34,6 +34,8 @@ func supportsIPv6ListenLocal() bool {
}
// isIPv6 checks if the provided IP is v6.
//
//lint:ignore U1000 use in os_windows.go
func isIPv6(ip string) bool {
parsedIP := net.ParseIP(ip)
return parsedIP != nil && parsedIP.To4() == nil && parsedIP.To16() != nil