close #8
This commit is contained in:
parent
bbdf98d88a
commit
cd324e1d48
|
@ -9,7 +9,7 @@ import (
|
|||
"log"
|
||||
)
|
||||
|
||||
const MAX_RECURSION = 15
|
||||
const MAX_RECURSION = 10
|
||||
|
||||
type DnsHandler struct {
|
||||
DnsResolvers []string
|
||||
|
@ -44,9 +44,9 @@ func (h *DnsHandler) resolveExternal(domain string, qtype uint16) ([]dns.RR, err
|
|||
return in.Answer, nil
|
||||
}
|
||||
|
||||
func resultSetFound(answers []dns.RR, domain string, qtype uint16) bool {
|
||||
func resultSetFound(answers []dns.RR, qtype uint16) bool {
|
||||
for _, answer := range answers {
|
||||
if answer.Header().Name == domain && answer.Header().Rrtype == qtype {
|
||||
if answer.Header().Rrtype == qtype {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
@ -117,13 +117,13 @@ func (h *DnsHandler) resolveDNS(domain string, qtype uint16, maxDepth int) ([]dn
|
|||
}
|
||||
|
||||
answers = append(answers, externalAnswers...)
|
||||
if resultSetFound(externalAnswers, domain, qtype) {
|
||||
if resultSetFound(answers, qtype) {
|
||||
return answers, false, nil
|
||||
}
|
||||
|
||||
for _, answer := range externalAnswers {
|
||||
cname, ok := answer.(*dns.CNAME)
|
||||
if !ok {
|
||||
cname, cnameCastErr := answer.(*dns.CNAME)
|
||||
if !cnameCastErr {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue