aboutsummaryrefslogtreecommitdiff
path: root/plugin/any/setup.go
diff options
context:
space:
mode:
authorGravatar Miek Gieben <miek@miek.nl> 2019-04-28 11:46:45 +0100
committerGravatar GitHub <noreply@github.com> 2019-04-28 11:46:45 +0100
commit39bc2af5092a64f6ac7c9d2ff7ba2bded8f682c8 (patch)
treed72ee7f5fced3aadf4347e3ff0a73ea0b9024ad8 /plugin/any/setup.go
parent4f7fb98284f9e3a24232af921ddc5bf852e998da (diff)
downloadcoredns-39bc2af5092a64f6ac7c9d2ff7ba2bded8f682c8.tar.gz
coredns-39bc2af5092a64f6ac7c9d2ff7ba2bded8f682c8.tar.zst
coredns-39bc2af5092a64f6ac7c9d2ff7ba2bded8f682c8.zip
Add any plugin (#2801)
* Add any plugin This adds the any plugin, a plain copy of coredns/any documented here https://coredns.io/explugins/any/ as an external plugin. Fixes: #2785 Signed-off-by: Miek Gieben <miek@miek.nl> * Stickler bot nit Signed-off-by: Miek Gieben <miek@miek.nl>
Diffstat (limited to 'plugin/any/setup.go')
-rw-r--r--plugin/any/setup.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugin/any/setup.go b/plugin/any/setup.go
new file mode 100644
index 000000000..de4697a82
--- /dev/null
+++ b/plugin/any/setup.go
@@ -0,0 +1,26 @@
+package any
+
+import (
+ "github.com/coredns/coredns/core/dnsserver"
+ "github.com/coredns/coredns/plugin"
+
+ "github.com/mholt/caddy"
+)
+
+func init() {
+ caddy.RegisterPlugin("any", caddy.Plugin{
+ ServerType: "dns",
+ Action: setup,
+ })
+}
+
+func setup(c *caddy.Controller) error {
+ a := Any{}
+
+ dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
+ a.Next = next
+ return a
+ })
+
+ return nil
+}