Skip to content

Commit deb9ab5

Browse files
committed
use slice.Contains instead of loop
1 parent 9373624 commit deb9ab5

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

dnssec-backend.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"fmt"
77
"log/slog"
88
"os"
9+
"slices"
910
"strings"
1011
"time"
1112

@@ -410,10 +411,8 @@ func denialNSEC(nsec []dns.RR, qname string, qtype uint16) error {
410411

411412
if c1 >= 0 && c2 < 0 {
412413
Log.Debug("NSEC record covers non-existent domain", slog.String("qname", qname), slog.String("record", n.String()))
413-
for _, t := range n.TypeBitMap {
414-
if t == qtype {
415-
return errors.New("NSEC denial failed, type " + dns.TypeToString[qtype] + " exists in bitmap")
416-
}
414+
if slices.Contains(n.TypeBitMap, qtype) {
415+
return errors.New("NSEC denial failed, type " + dns.TypeToString[qtype] + " exists in bitmap")
417416
}
418417
Log.Debug("Denial", slog.String("message", "secure authenticated denial of existence using NSEC for domain"), slog.String("qname", qname), slog.String("qtype", dns.TypeToString[qtype]))
419418
return nil

0 commit comments

Comments
 (0)