diff options
| author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-05-12 14:20:47 -0700 |
|---|---|---|
| committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2024-05-12 14:20:47 -0700 |
| commit | cd324e1d48505410f0b11f26d6c415415ebf098e (patch) | |
| tree | 654b8b14b537cf0b58e7e20b3f8857b4cab55b35 /hcdns | |
| parent | bbdf98d88ac8a19e6edb5f85ef1d1ebf94f02d23 (diff) | |
| download | hatecomputers.club-cd324e1d48505410f0b11f26d6c415415ebf098e.tar.gz hatecomputers.club-cd324e1d48505410f0b11f26d6c415415ebf098e.zip | |
close #8
Diffstat (limited to 'hcdns')
| -rw-r--r-- | hcdns/server.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/hcdns/server.go b/hcdns/server.go index 0fe412b..385c2ef 100644 --- a/hcdns/server.go +++ b/hcdns/server.go @@ -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 } |
