summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-05-12 14:20:47 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-05-12 14:20:47 -0700
commitcd324e1d48505410f0b11f26d6c415415ebf098e (patch)
tree654b8b14b537cf0b58e7e20b3f8857b4cab55b35
parentbbdf98d88ac8a19e6edb5f85ef1d1ebf94f02d23 (diff)
downloadhatecomputers.club-cd324e1d48505410f0b11f26d6c415415ebf098e.tar.gz
hatecomputers.club-cd324e1d48505410f0b11f26d6c415415ebf098e.zip
close #8
-rw-r--r--hcdns/server.go12
-rw-r--r--main.go4
2 files changed, 10 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
}
diff --git a/main.go b/main.go
index e92f777..fd703f0 100644
--- a/main.go
+++ b/main.go
@@ -60,7 +60,11 @@ func main() {
log.Fatal(err)
}
}()
+ }
+ if argv.Dns || argv.Server {
select {}
}
+
+ log.Println("no services started")
}