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>
This commit is contained in:
parent
4f7fb98284
commit
39bc2af509
8 changed files with 129 additions and 0 deletions
26
plugin/any/setup.go
Normal file
26
plugin/any/setup.go
Normal file
|
@ -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
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue