mirror of
https://github.com/coredns/coredns.git
synced 2026-04-05 03:35:33 -04:00
23 lines
431 B
Go
23 lines
431 B
Go
package whoami
|
|
|
|
import (
|
|
"github.com/coredns/caddy"
|
|
"github.com/coredns/coredns/core/dnsserver"
|
|
"github.com/coredns/coredns/plugin"
|
|
)
|
|
|
|
func init() { plugin.Register("whoami", setup) }
|
|
|
|
func setup(c *caddy.Controller) error {
|
|
c.Next() // 'whoami'
|
|
if c.NextArg() {
|
|
return plugin.Error("whoami", c.ArgErr())
|
|
}
|
|
|
|
dnsserver.GetConfig(c).AddPlugin(func(_next plugin.Handler) plugin.Handler {
|
|
return Whoami{}
|
|
})
|
|
|
|
return nil
|
|
}
|