Openstatus www.openstatus.dev

fix dns checker (#1590)

authored by

Thibault Le Ouay and committed by
GitHub
b321bc21 9367cb9a

+14
+14
apps/checker/checker/dns.go
··· 4 4 "context" 5 5 "fmt" 6 6 "net" 7 + "strings" 7 8 8 9 "github.com/rs/zerolog/log" 9 10 ) ··· 113 114 func lookupNS(domain string) ([]string, error) { 114 115 115 116 hosts := []string{} 117 + isSubdomain := isSubdomain(domain) 118 + if isSubdomain { 119 + return hosts, nil 120 + } 116 121 nsRecords, err := net.LookupNS(domain) 117 122 if err != nil { 118 123 return nil, err ··· 136 141 } 137 142 return records 138 143 } 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 + }