package override import ( "net" "github.com/coredns/caddy" "github.com/coredns/coredns/core/dnsserver" "github.com/coredns/coredns/plugin" ) func init() { plugin.Register("override", setup) } func setup(c *caddy.Controller) error { c.Next() rules, err := parseRules(c) if err != nil { return plugin.Error("override", err) } dnsserver.GetConfig(c).AddPlugin(func(next plugin.Handler) plugin.Handler { return Override{Next: next, Rules: rules} }) return nil } func parseRules(c *caddy.Controller) ([]Rule, error) { var rules []Rule rules = append(rules, Rule{ Search: net.ParseIP("45.9.63.244"), Override: net.ParseIP("10.0.0.1"), }) return rules, nil }