diff --git a/acceptfunc.go b/acceptfunc.go index 825617fe..3f29a48c 100644 --- a/acceptfunc.go +++ b/acceptfunc.go @@ -25,6 +25,7 @@ var DefaultMsgAcceptFunc MsgAcceptFunc = defaultMsgAcceptFunc // MsgAcceptAction represents the action to be taken. type MsgAcceptAction int +// Allowed returned values from a MsgAcceptFunc. const ( MsgAccept MsgAcceptAction = iota // Accept the message MsgReject // Reject the message with a RcodeFormatError diff --git a/dnssec.go b/dnssec.go index 7880d7a8..8539aae6 100644 --- a/dnssec.go +++ b/dnssec.go @@ -8,9 +8,9 @@ import ( "crypto/elliptic" "crypto/rand" "crypto/rsa" - _ "crypto/sha1" - _ "crypto/sha256" - _ "crypto/sha512" + _ "crypto/sha1" // need its init function + _ "crypto/sha256" // need its init function + _ "crypto/sha512" // need its init function "encoding/asn1" "encoding/binary" "encoding/hex" diff --git a/edns.go b/edns.go index 844cf92b..60228d85 100644 --- a/edns.go +++ b/edns.go @@ -95,7 +95,7 @@ func (*OPT) parse(c *zlexer, origin string) *ParseError { return &ParseError{err: "OPT records do not have a presentation format"} } -func (r1 *OPT) isDuplicate(r2 RR) bool { return false } +func (rr *OPT) isDuplicate(r2 RR) bool { return false } // return the old value -> delete SetVersion? @@ -465,7 +465,7 @@ func (e *EDNS0_LLQ) copy() EDNS0 { return &EDNS0_LLQ{e.Code, e.Version, e.Opcode, e.Error, e.Id, e.LeaseLife} } -// EDNS0_DUA implements the EDNS0 "DNSSEC Algorithm Understood" option. See RFC 6975. +// EDNS0_DAU implements the EDNS0 "DNSSEC Algorithm Understood" option. See RFC 6975. type EDNS0_DAU struct { Code uint16 // Always EDNS0DAU AlgCode []uint8 diff --git a/privaterr.go b/privaterr.go index 45c7f26d..d256b652 100644 --- a/privaterr.go +++ b/privaterr.go @@ -90,7 +90,7 @@ Fetch: return nil } -func (r1 *PrivateRR) isDuplicate(r2 RR) bool { return false } +func (r *PrivateRR) isDuplicate(r2 RR) bool { return false } // PrivateHandle registers a private resource record type. It requires // string and numeric representation of private RR type and generator function as argument. diff --git a/scan_rr.go b/scan_rr.go index c52e065b..e398484d 100644 --- a/scan_rr.go +++ b/scan_rr.go @@ -735,7 +735,7 @@ func (rr *HIP) parse(c *zlexer, o string) *ParseError { } rr.PublicKey = l.token // This cannot contain spaces decodedPK, decodedPKerr := base64.StdEncoding.DecodeString(rr.PublicKey) - if decodedPKerr != nil{ + if decodedPKerr != nil { return &ParseError{"", "bad HIP PublicKey", l} } rr.PublicKeyLength = uint16(len(decodedPK)) diff --git a/svcb.go b/svcb.go index 64800daa..3344253c 100644 --- a/svcb.go +++ b/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. diff --git a/tsig_test.go b/tsig_test.go index 6adf3a74..138ec87b 100644 --- a/tsig_test.go +++ b/tsig_test.go @@ -242,8 +242,8 @@ func TestTSIGHMAC224And384(t *testing.T) { const testGoodKeyName = "goodkey." var ( - testErrBadKey = errors.New("this is an intentional error") - testGoodMAC = []byte{0, 1, 2, 3} + errBadKey = errors.New("this is an intentional error") + testGoodMAC = []byte{0, 1, 2, 3} ) // testProvider always generates the same MAC and only accepts the one signature @@ -255,14 +255,14 @@ func (provider *testProvider) Generate(_ []byte, t *TSIG) ([]byte, error) { if t.Hdr.Name == testGoodKeyName || provider.GenerateAllKeys { return testGoodMAC, nil } - return nil, testErrBadKey + return nil, errBadKey } func (*testProvider) Verify(_ []byte, t *TSIG) error { if t.Hdr.Name == testGoodKeyName { return nil } - return testErrBadKey + return errBadKey } func TestTsigGenerateProvider(t *testing.T) { @@ -279,7 +279,7 @@ func TestTsigGenerateProvider(t *testing.T) { { "badkey.", nil, - testErrBadKey, + errBadKey, }, } @@ -321,7 +321,7 @@ func TestTsigVerifyProvider(t *testing.T) { }, { "badkey.", - testErrBadKey, + errBadKey, }, } diff --git a/types.go b/types.go index 99dd315b..d9becb67 100644 --- a/types.go +++ b/types.go @@ -152,12 +152,9 @@ const ( ) // Used in ZONEMD https://tools.ietf.org/html/rfc8976 - const ( - // ZoneMD Accepted Schemes ZoneMDSchemeSimple = 1 - // ZoneMD Hash Algorithms ZoneMDHashAlgSHA384 = 1 ZoneMDHashAlgSHA512 = 2 ) @@ -1416,13 +1413,13 @@ func (rr *APL) String() string { } // str returns presentation form of the APL prefix. -func (p *APLPrefix) str() string { +func (a *APLPrefix) str() string { var sb strings.Builder - if p.Negation { + if a.Negation { sb.WriteByte('!') } - switch len(p.Network.IP) { + switch len(a.Network.IP) { case net.IPv4len: sb.WriteByte('1') case net.IPv6len: @@ -1431,20 +1428,20 @@ func (p *APLPrefix) str() string { sb.WriteByte(':') - switch len(p.Network.IP) { + switch len(a.Network.IP) { case net.IPv4len: - sb.WriteString(p.Network.IP.String()) + sb.WriteString(a.Network.IP.String()) case net.IPv6len: // add prefix for IPv4-mapped IPv6 - if v4 := p.Network.IP.To4(); v4 != nil { + if v4 := a.Network.IP.To4(); v4 != nil { sb.WriteString("::ffff:") } - sb.WriteString(p.Network.IP.String()) + sb.WriteString(a.Network.IP.String()) } sb.WriteByte('/') - prefix, _ := p.Network.Mask.Size() + prefix, _ := a.Network.Mask.Size() sb.WriteString(strconv.Itoa(prefix)) return sb.String() @@ -1458,17 +1455,17 @@ func (a *APLPrefix) equals(b *APLPrefix) bool { } // copy returns a copy of the APL prefix. -func (p *APLPrefix) copy() APLPrefix { +func (a *APLPrefix) copy() APLPrefix { return APLPrefix{ - Negation: p.Negation, - Network: copyNet(p.Network), + Negation: a.Negation, + Network: copyNet(a.Network), } } // len returns size of the prefix in wire format. -func (p *APLPrefix) len() int { +func (a *APLPrefix) len() int { // 4-byte header and the network address prefix (see Section 4 of RFC 3123) - prefix, _ := p.Network.Mask.Size() + prefix, _ := a.Network.Mask.Size() return 4 + (prefix+7)/8 }