@@ 18,16 18,25 @@ import (
func parseQuery(m *dns.Msg, r *dns.Msg) {
for _, q := range m.Question {
+ slog.Info("Got Query",
+ slog.Any("id", r.Id),
+ slog.String("type", dns.TypeToString[q.Qtype]),
+ slog.String("qname", q.Name),
+ )
+
switch q.Qtype {
case dns.TypeA:
handleARecord(&q, m, r)
}
+
+ slog.Info("Responding to Query",
+ slog.Any("id", r.Id),
+ slog.String("rcode", dns.RcodeToString[m.Rcode]),
+ )
}
}
func handleARecord(q *dns.Question, m *dns.Msg, r *dns.Msg) {
- slog.Info("A Record Query", slog.String("qname", q.Name))
-
if index := strings.IndexByte(q.Name, '.'); index >= 0 {
aRecord, err := db.FetchDomainARecord(strings.ToLower(q.Name[:index]))
if err != nil {