Abstract the caddy call and make it simpler. See #3261 for some part of the discussion. Go from: ~~~ go func init() { caddy.RegisterPlugin("any", caddy.Plugin{ ServerType: "dns", Action: setup, }) } ~~~ To: ~~~ go func init() { plugin.Register("any", setup) } ~~~ This requires some external documents in coredns.io to be updated as well; the old way still works, so it's backwards compatible. Signed-off-by: Miek Gieben <miek@miek.nl>
11 lines
301 B
Go
11 lines
301 B
Go
package plugin
|
|
|
|
import "github.com/caddyserver/caddy"
|
|
|
|
// Register registers your plugin with CoreDNS and allows it to be called when the server is running.
|
|
func Register(name string, action caddy.SetupFunc) {
|
|
caddy.RegisterPlugin(name, caddy.Plugin{
|
|
ServerType: "dns",
|
|
Action: action,
|
|
})
|
|
}
|