aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar varyoo <varyoo@users.noreply.github.com> 2018-08-02 00:58:23 +0200
committerGravatar corbot[bot] <corbot[bot]@users.noreply.github.com> 2018-08-01 22:58:23 +0000
commit9cea32f013739a17a07b096f117b6e5899006d3f (patch)
tree764ba667e63e37ab02c7494bcc6e766f608f7e72
parent2b4878195c58a37df1e491cfb581523e6d4aa058 (diff)
downloadcoredns-9cea32f013739a17a07b096f117b6e5899006d3f.tar.gz
coredns-9cea32f013739a17a07b096f117b6e5899006d3f.tar.zst
coredns-9cea32f013739a17a07b096f117b6e5899006d3f.zip
dnstap.TapperFromContext always returns nil (#2018)
Automatically submitted.
-rw-r--r--plugin/dnstap/context_test.go15
-rw-r--r--plugin/dnstap/handler.go2
2 files changed, 16 insertions, 1 deletions
diff --git a/plugin/dnstap/context_test.go b/plugin/dnstap/context_test.go
new file mode 100644
index 000000000..04728e032
--- /dev/null
+++ b/plugin/dnstap/context_test.go
@@ -0,0 +1,15 @@
+package dnstap
+
+import (
+ "context"
+ "testing"
+)
+
+func TestDnstapContext(t *testing.T) {
+ ctx := tapContext{context.TODO(), Dnstap{}}
+ tapper := TapperFromContext(ctx)
+
+ if tapper == nil {
+ t.Fatal("Can't get tapper")
+ }
+}
diff --git a/plugin/dnstap/handler.go b/plugin/dnstap/handler.go
index 1c411e2aa..b09c70406 100644
--- a/plugin/dnstap/handler.go
+++ b/plugin/dnstap/handler.go
@@ -51,7 +51,7 @@ func TapperFromContext(ctx context.Context) (t Tapper) {
}
// TapMessage implements Tapper.
-func (h *Dnstap) TapMessage(m *tap.Message) {
+func (h Dnstap) TapMessage(m *tap.Message) {
t := tap.Dnstap_MESSAGE
h.IO.Dnstap(tap.Dnstap{
Type: &t,