Skip to content

Open-source status page, incident response and uptime monitoring

fix dns checker (#1590)

Thibault Le Ouayb321bc211420
diff --git a/apps/checker/checker/dns.go b/apps/checker/checker/dns.go
index 526cda14c..e78d53909 100644
--- a/apps/checker/checker/dns.go
+++ b/apps/checker/checker/dns.go
@@ -4,6 +4,7 @@ import (
"context"
"fmt"
"net"
+ "strings"
"github.com/rs/zerolog/log"
)
@@ -113,6 +114,10 @@ func lookupMX(domain string) ([]string) {
func lookupNS(domain string) ([]string, error) {
hosts := []string{}
+ isSubdomain := isSubdomain(domain)
+ if isSubdomain {
+ return hosts, nil
+ }
nsRecords, err := net.LookupNS(domain)
if err != nil {
return nil, err
@@ -136,3 +141,12 @@ func lookupTXT(domain string) ([]string) {
}
return records
}
+
+
+func isSubdomain(domain string) bool {
+ parent := strings.Split(domain, ".")
+ if len(parent) < 3 {
+ return false
+ }
+ return true
+}