File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -291,26 +291,19 @@ func IsFqdn(s string) bool {
291291 return (len (s )- i )% 2 != 0
292292}
293293
294- // IsRRset checks if a set of RRs is a valid RRset as defined by RFC 2181.
295- // This means the RRs need to have the same type, name, and class. Returns true
296- // if the RR set is valid, otherwise false.
294+ // IsRRset reports whether a set of RRs is a valid RRset as defined by RFC 2181.
295+ // This means the RRs need to have the same type, name, and class.
297296func IsRRset (rrset []RR ) bool {
298297 if len (rrset ) == 0 {
299298 return false
300299 }
301- if len (rrset ) == 1 {
302- return true
303- }
304- rrHeader := rrset [0 ].Header ()
305- rrType := rrHeader .Rrtype
306- rrClass := rrHeader .Class
307- rrName := rrHeader .Name
308300
301+ baseH := rrset [0 ].Header ()
309302 for _ , rr := range rrset [1 :] {
310- curRRHeader := rr .Header ()
311- if curRRHeader .Rrtype != rrType || curRRHeader .Class != rrClass || curRRHeader .Name != rrName {
303+ curH := rr .Header ()
304+ if curH .Rrtype != baseH . Rrtype || curH .Class != baseH . Class || curH .Name != baseH . Name {
312305 // Mismatch between the records, so this is not a valid rrset for
313- //signing/verifying
306+ // signing/verifying
314307 return false
315308 }
316309 }
You can’t perform that action at this time.
0 commit comments