mirror of
https://github.com/Control-D-Inc/ctrld.git
synced 2026-07-04 01:07:49 +02:00
all: satisfy staticcheck
This commit is contained in:
committed by
Cuong Manh Le
parent
46965b04b4
commit
f6371360bc
@@ -1,3 +1,4 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
|
//lint:ignore U1000 use in os_linux.go
|
||||||
type getDNS func(iface string) []string
|
type getDNS func(iface string) []string
|
||||||
|
|||||||
@@ -282,11 +282,12 @@ func containRcode(rcodes []int, rcode int) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setCachedAnswerTTL(answer *dns.Msg, now, expiredTime time.Time) {
|
func setCachedAnswerTTL(answer *dns.Msg, now, expiredTime time.Time) {
|
||||||
ttl := uint32(expiredTime.Sub(now).Seconds())
|
ttlSecs := expiredTime.Sub(now).Seconds()
|
||||||
if ttl < 0 {
|
if ttlSecs < 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ttl := uint32(ttlSecs)
|
||||||
for _, rr := range answer.Answer {
|
for _, rr := range answer.Answer {
|
||||||
rr.Header().Ttl = ttl
|
rr.Header().Ttl = ttl
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ func supportsIPv6ListenLocal() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// isIPv6 checks if the provided IP is v6.
|
// isIPv6 checks if the provided IP is v6.
|
||||||
|
//
|
||||||
|
//lint:ignore U1000 use in os_windows.go
|
||||||
func isIPv6(ip string) bool {
|
func isIPv6(ip string) bool {
|
||||||
parsedIP := net.ParseIP(ip)
|
parsedIP := net.ParseIP(ip)
|
||||||
return parsedIP != nil && parsedIP.To4() == nil && parsedIP.To16() != nil
|
return parsedIP != nil && parsedIP.To4() == nil && parsedIP.To16() != nil
|
||||||
|
|||||||
-11
@@ -5,7 +5,6 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/miekg/dns"
|
"github.com/miekg/dns"
|
||||||
@@ -96,13 +95,3 @@ func (r *legacyResolver) Resolve(ctx context.Context, msg *dns.Msg) (*dns.Msg, e
|
|||||||
answer, _, err := dnsClient.ExchangeContext(ctx, msg, r.endpoint)
|
answer, _, err := dnsClient.ExchangeContext(ctx, msg, r.endpoint)
|
||||||
return answer, err
|
return answer, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// canonicalName returns canonical name from FQDN with "." trimmed.
|
|
||||||
func canonicalName(fqdn string) string {
|
|
||||||
q := strings.TrimSpace(fqdn)
|
|
||||||
q = strings.TrimSuffix(q, ".")
|
|
||||||
// https://datatracker.ietf.org/doc/html/rfc4343
|
|
||||||
q = strings.ToLower(q)
|
|
||||||
|
|
||||||
return q
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user