fix(log): synthesize deferred error responses (#8200)

Signed-off-by: immanuwell <pchpr.00@list.ru>
This commit is contained in:
Immanuel Tikhonov
2026-06-26 12:58:20 +04:00
committed by GitHub
parent 1936a2bb40
commit 1539f9b7d6
2 changed files with 81 additions and 0 deletions

View File

@@ -35,6 +35,13 @@ func (l Logger) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
rrw := dnstest.NewRecorder(w)
rc, err := plugin.NextOrFailure(l.Name(), l.Next, ctx, rrw, r)
if rrw.Msg == nil && !plugin.ClientWrite(rc) {
msg := new(dns.Msg)
msg.SetRcode(r, rc)
rrw.Msg = msg
rrw.Rcode = rc
rrw.Len = msg.Len()
}
tpe, _ := response.Typify(rrw.Msg, time.Now().UTC())
metadata.SetValueFunc(ctx, "log/type", func() string {