diff options
Diffstat (limited to 'vendor/github.com/miekg/dns/svcb.go')
-rw-r--r-- | vendor/github.com/miekg/dns/svcb.go | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/vendor/github.com/miekg/dns/svcb.go b/vendor/github.com/miekg/dns/svcb.go index 1373fe2..3344253 100644 --- a/vendor/github.com/miekg/dns/svcb.go +++ b/vendor/github.com/miekg/dns/svcb.go @@ -10,6 +10,7 @@ import ( "strings" ) +// SVCBKey is the type of the keys used in the SVCB RR. type SVCBKey uint16 // Keys defined in draft-ietf-dnsop-svcb-https-01 Section 12.3.2. @@ -321,7 +322,7 @@ func (s *SVCBAlpn) pack() ([]byte, error) { // Liberally estimate the size of an alpn as 10 octets b := make([]byte, 0, 10*len(s.Alpn)) for _, e := range s.Alpn { - if len(e) == 0 { + if e == "" { return nil, errors.New("dns: svcbalpn: empty alpn-id") } if len(e) > 255 { @@ -390,7 +391,7 @@ func (*SVCBNoDefaultAlpn) unpack(b []byte) error { } func (*SVCBNoDefaultAlpn) parse(b string) error { - if len(b) != 0 { + if b != "" { return errors.New("dns: svcbnodefaultalpn: no_default_alpn must have no value") } return nil @@ -511,8 +512,13 @@ func (s *SVCBIPv4Hint) parse(b string) error { } func (s *SVCBIPv4Hint) copy() SVCBKeyValue { + hint := make([]net.IP, len(s.Hint)) + for i, ip := range s.Hint { + hint[i] = copyIP(ip) + } + return &SVCBIPv4Hint{ - append([]net.IP(nil), s.Hint...), + Hint: hint, } } @@ -629,8 +635,13 @@ func (s *SVCBIPv6Hint) parse(b string) error { } func (s *SVCBIPv6Hint) copy() SVCBKeyValue { + hint := make([]net.IP, len(s.Hint)) + for i, ip := range s.Hint { + hint[i] = copyIP(ip) + } + return &SVCBIPv6Hint{ - append([]net.IP(nil), s.Hint...), + Hint: hint, } } |