1
0
Fork 0
alias/setup.go

23 lines
424 B
Go
Raw Permalink Normal View History

2017-08-20 09:55:02 +08:00
package alias
import (
"github.com/coredns/caddy"
2017-08-20 09:55:02 +08:00
"github.com/coredns/coredns/core/dnsserver"
2017-09-16 18:20:21 +08:00
"github.com/coredns/coredns/plugin"
2017-08-20 09:55:02 +08:00
)
func init() { plugin.Register("alias", setup) }
2017-08-20 09:55:02 +08:00
func setup(c *caddy.Controller) error {
c.Next()
if c.NextArg() {
2017-09-16 18:20:21 +08:00
return plugin.Error("alias", c.ArgErr())
2017-08-20 09:55:02 +08:00
}
2017-09-16 18:20:21 +08:00
dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler {
2017-08-20 09:55:02 +08:00
return Alias{Next: next}
})
return nil
}