diff options
Diffstat (limited to 'plugin/dnstap/gocontext.go')
-rw-r--r-- | plugin/dnstap/gocontext.go | 23 |
1 files changed, 0 insertions, 23 deletions
diff --git a/plugin/dnstap/gocontext.go b/plugin/dnstap/gocontext.go deleted file mode 100644 index a8cc2c2b4..000000000 --- a/plugin/dnstap/gocontext.go +++ /dev/null @@ -1,23 +0,0 @@ -package dnstap - -import "context" - -type contextKey struct{} - -var dnstapKey = contextKey{} - -// ContextWithTapper returns a new `context.Context` that holds a reference to -// `t`'s Tapper. -func ContextWithTapper(ctx context.Context, t Tapper) context.Context { - return context.WithValue(ctx, dnstapKey, t) -} - -// TapperFromContext returns the `Tapper` previously associated with `ctx`, or -// `nil` if no such `Tapper` could be found. -func TapperFromContext(ctx context.Context) Tapper { - val := ctx.Value(dnstapKey) - if sp, ok := val.(Tapper); ok { - return sp - } - return nil -} |