Dont nest so deep. Used a goto for now
This commit is contained in:
parent
74cffb0578
commit
20b8675868
|
@ -19,7 +19,7 @@ var (
|
|||
conf *dns.ClientConfig
|
||||
)
|
||||
|
||||
func localQuery(qname string, qtype uint16) (r *dns.Msg, err error) {
|
||||
func localQuery(qname string, qtype uint16) (*dns.Msg, error) {
|
||||
localm.SetQuestion(qname, qtype)
|
||||
for i := range conf.Servers {
|
||||
server := conf.Servers[i]
|
||||
|
@ -118,15 +118,18 @@ func main() {
|
|||
if soa == nil {
|
||||
success = false
|
||||
fmt.Printf("%s (%s) ", ip, err)
|
||||
} else {
|
||||
goto Next
|
||||
}
|
||||
if soa.Rcode != dns.RcodeSuccess {
|
||||
success = false
|
||||
fmt.Printf("%s (%s) ", ips, dns.Rcode_str[soa.Rcode])
|
||||
} else {
|
||||
goto Next
|
||||
}
|
||||
if len(soa.Answer) == 0 { // May happen if the server is a recursor, not authoritative, since we query with RD=0
|
||||
success = false
|
||||
fmt.Printf("%s (0 answer) ", ip)
|
||||
} else {
|
||||
goto Next
|
||||
}
|
||||
rsoa := soa.Answer[0]
|
||||
switch rsoa.(type) {
|
||||
case *dns.RR_SOA:
|
||||
|
@ -139,9 +142,7 @@ func main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Next:
|
||||
fmt.Printf("\n")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue