summaryrefslogtreecommitdiff
path: root/hcdns/server.go
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-04-07 19:02:42 -0600
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-04-07 19:02:42 -0600
commite2ce6804a76c771759603e3b3800a013275217a1 (patch)
treefa0303581fdfc166ffaf3c9a482434a2ffa34e3e /hcdns/server.go
parent5768f07ce51271239b16b4cfda6206366002cefc (diff)
downloadhatecomputers.club-e2ce6804a76c771759603e3b3800a013275217a1.tar.gz
hatecomputers.club-e2ce6804a76c771759603e3b3800a013275217a1.zip
be authoritative, but only when there's no external queries occuring
Diffstat (limited to 'hcdns/server.go')
-rw-r--r--hcdns/server.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/hcdns/server.go b/hcdns/server.go
index e5a8d29..2e110e8 100644
--- a/hcdns/server.go
+++ b/hcdns/server.go
@@ -70,11 +70,12 @@ func (h *DnsHandler) recursiveResolve(domain string, qtype uint16, maxDepth int)
answers = append(answers, cname)
cnameRecursive, cnameAuth, err := h.resolveDNS(record.Content, qtype, maxDepth-1)
+ authoritative = authoritative && cnameAuth
if err != nil {
log.Println(err)
return nil, authoritative, err
}
- authoritative = authoritative && cnameAuth
+
answers = append(answers, cnameRecursive...)
}
@@ -126,14 +127,16 @@ func (h *DnsHandler) resolveDNS(domain string, qtype uint16, maxDepth int) ([]dn
continue
}
- cnameAnswers, _, err := h.resolveDNS(cname.Target, qtype, maxDepth-1)
+ cnameAnswers, cnameAuth, err := h.resolveDNS(cname.Target, qtype, maxDepth-1)
+ authoritative = authoritative && cnameAuth
if err != nil {
return nil, false, err
}
answers = append(answers, cnameAnswers...)
}
- return answers, false, nil
+ authoritative = authoritative && len(externalAnswers) == 0
+ return answers, authoritative, nil
}
func (h *DnsHandler) ServeDNS(w dns.ResponseWriter, r *dns.Msg) {