DEVELOPMENT ENVIRONMENT

~liljamo/felu

6f7f908bca0b8619e9e251a23738d27df57c4d82 — Jonni Liljamo a month ago abd4718
feat: log unsupported Opcodes
1 files changed, 8 insertions(+), 1 deletions(-)

M internal/dns/handle.go
M internal/dns/handle.go => internal/dns/handle.go +8 -1
@@ 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)