aboutsummaryrefslogtreecommitdiff
path: root/core/dnsserver/view.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/dnsserver/view.go')
-rw-r--r--core/dnsserver/view.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/dnsserver/view.go b/core/dnsserver/view.go
new file mode 100644
index 000000000..ac797839d
--- /dev/null
+++ b/core/dnsserver/view.go
@@ -0,0 +1,20 @@
+package dnsserver
+
+import (
+ "context"
+
+ "github.com/coredns/coredns/request"
+)
+
+// Viewer - If Viewer is implemented by a plugin in a server block, its Filter()
+// is added to the server block's filter functions when starting the server. When a running server
+// serves a DNS request, it will route the request to the first Config (server block) that passes
+// all its filter functions.
+type Viewer interface {
+ // Filter returns true if the server should use the server block in which the implementing plugin resides, and the
+ // name of the view for metrics logging.
+ Filter(ctx context.Context, req *request.Request) bool
+
+ // ViewName returns the name of the view
+ ViewName() string
+}