Skip to content

Commit b321bc2

Browse files
fix dns checker (#1590)
1 parent 9367cb9 commit b321bc2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

apps/checker/checker/dns.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"fmt"
66
"net"
7+
"strings"
78

89
"github.com/rs/zerolog/log"
910
)
@@ -113,6 +114,10 @@ func lookupMX(domain string) ([]string) {
113114
func lookupNS(domain string) ([]string, error) {
114115

115116
hosts := []string{}
117+
isSubdomain := isSubdomain(domain)
118+
if isSubdomain {
119+
return hosts, nil
120+
}
116121
nsRecords, err := net.LookupNS(domain)
117122
if err != nil {
118123
return nil, err
@@ -136,3 +141,12 @@ func lookupTXT(domain string) ([]string) {
136141
}
137142
return records
138143
}
144+
145+
146+
func isSubdomain(domain string) bool {
147+
parent := strings.Split(domain, ".")
148+
if len(parent) < 3 {
149+
return false
150+
}
151+
return true
152+
}

0 commit comments

Comments
 (0)