From 6f7f908bca0b8619e9e251a23738d27df57c4d82 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Wed, 9 Oct 2024 13:25:59 +0300 Subject: [PATCH] feat: log unsupported Opcodes --- internal/dns/handle.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/internal/dns/handle.go b/internal/dns/handle.go index 29a040d..b9b9979 100644 --- a/internal/dns/handle.go +++ b/internal/dns/handle.go @@ -7,7 +7,11 @@ package dns -import "github.com/miekg/dns" +import ( + "log/slog" + + "github.com/miekg/dns" +) func handleDNSRequest(w dns.ResponseWriter, r *dns.Msg) { m := new(dns.Msg) @@ -17,6 +21,9 @@ func handleDNSRequest(w dns.ResponseWriter, r *dns.Msg) { switch r.Opcode { case dns.OpcodeQuery: parseQuery(m, r) + default: + slog.Info("Unsupported Opcode", slog.String("type", dns.OpcodeToString[r.Opcode])) + m.SetRcode(r, dns.RcodeNotImplemented) } w.WriteMsg(m) -- 2.44.1