aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Takeshi Yoneda <t.y.mathetake@gmail.com> 2024-04-27 04:08:47 +0900
committerGravatar GitHub <noreply@github.com> 2024-04-26 15:08:47 -0400
commita7ed346585e30b99317d36e4d007b7b19a228ea5 (patch)
treef245570a888bfa2f538fecb26efe3050883ffee9
parent4531515f2b0fafa02a282d4b78ad94623827584b (diff)
downloadcoredns-a7ed346585e30b99317d36e4d007b7b19a228ea5.tar.gz
coredns-a7ed346585e30b99317d36e4d007b7b19a228ea5.tar.zst
coredns-a7ed346585e30b99317d36e4d007b7b19a228ea5.zip
dnstap: uses pointer receiver for small response writer (#6644)v1.11.3
Signed-off-by: Takeshi Yoneda <t.y.mathetake@gmail.com>
-rw-r--r--plugin/dnstap/handler.go12
-rw-r--r--plugin/dnstap/writer.go2
2 files changed, 7 insertions, 7 deletions
diff --git a/plugin/dnstap/handler.go b/plugin/dnstap/handler.go
index 59dbabab2..1d5bd98e5 100644
--- a/plugin/dnstap/handler.go
+++ b/plugin/dnstap/handler.go
@@ -27,7 +27,7 @@ type Dnstap struct {
}
// TapMessage sends the message m to the dnstap interface, without populating "Extra" field.
-func (h Dnstap) TapMessage(m *tap.Message) {
+func (h *Dnstap) TapMessage(m *tap.Message) {
if h.ExtraFormat == "" {
h.tapWithExtra(m, nil)
} else {
@@ -36,7 +36,7 @@ func (h Dnstap) TapMessage(m *tap.Message) {
}
// TapMessageWithMetadata sends the message m to the dnstap interface, with "Extra" field being populated.
-func (h Dnstap) TapMessageWithMetadata(ctx context.Context, m *tap.Message, state request.Request) {
+func (h *Dnstap) TapMessageWithMetadata(ctx context.Context, m *tap.Message, state request.Request) {
if h.ExtraFormat == "" {
h.tapWithExtra(m, nil)
return
@@ -45,12 +45,12 @@ func (h Dnstap) TapMessageWithMetadata(ctx context.Context, m *tap.Message, stat
h.tapWithExtra(m, []byte(extraStr))
}
-func (h Dnstap) tapWithExtra(m *tap.Message, extra []byte) {
+func (h *Dnstap) tapWithExtra(m *tap.Message, extra []byte) {
t := tap.Dnstap_MESSAGE
h.io.Dnstap(&tap.Dnstap{Type: &t, Message: m, Identity: h.Identity, Version: h.Version, Extra: extra})
}
-func (h Dnstap) tapQuery(ctx context.Context, w dns.ResponseWriter, query *dns.Msg, queryTime time.Time) {
+func (h *Dnstap) tapQuery(ctx context.Context, w dns.ResponseWriter, query *dns.Msg, queryTime time.Time) {
q := new(tap.Message)
msg.SetQueryTime(q, queryTime)
msg.SetQueryAddress(q, w.RemoteAddr())
@@ -65,7 +65,7 @@ func (h Dnstap) tapQuery(ctx context.Context, w dns.ResponseWriter, query *dns.M
}
// ServeDNS logs the client query and response to dnstap and passes the dnstap Context.
-func (h Dnstap) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
+func (h *Dnstap) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg) (int, error) {
rw := &ResponseWriter{
ResponseWriter: w,
Dnstap: h,
@@ -82,4 +82,4 @@ func (h Dnstap) ServeDNS(ctx context.Context, w dns.ResponseWriter, r *dns.Msg)
}
// Name implements the plugin.Plugin interface.
-func (h Dnstap) Name() string { return "dnstap" }
+func (h *Dnstap) Name() string { return "dnstap" }
diff --git a/plugin/dnstap/writer.go b/plugin/dnstap/writer.go
index afd19ea5c..9ef6e620c 100644
--- a/plugin/dnstap/writer.go
+++ b/plugin/dnstap/writer.go
@@ -17,7 +17,7 @@ type ResponseWriter struct {
query *dns.Msg
ctx context.Context
dns.ResponseWriter
- Dnstap
+ *Dnstap
}
// WriteMsg writes back the response to the client and THEN works on logging the request and response to dnstap.