mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 00:34:24 -04:00
plugins: calling Dispenser itself is a mistake (#3323)
Remove all these uses and just make them work on caddy.Controller. Also don't export parsing functions as their should be private to the plugin. Signed-off-by: Miek Gieben <miek@miek.nl>
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"github.com/coredns/coredns/plugin/pkg/transport"
|
||||
|
||||
"github.com/caddyserver/caddy"
|
||||
"github.com/caddyserver/caddy/caddyfile"
|
||||
)
|
||||
|
||||
func init() { plugin.Register("forward", setup) }
|
||||
@@ -74,7 +73,7 @@ func parseForward(c *caddy.Controller) (*Forward, error) {
|
||||
return nil, plugin.ErrOnce
|
||||
}
|
||||
i++
|
||||
f, err = ParseForwardStanza(&c.Dispenser)
|
||||
f, err = parseStanza(c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -82,8 +81,7 @@ func parseForward(c *caddy.Controller) (*Forward, error) {
|
||||
return f, nil
|
||||
}
|
||||
|
||||
// ParseForwardStanza parses one forward stanza
|
||||
func ParseForwardStanza(c *caddyfile.Dispenser) (*Forward, error) {
|
||||
func parseStanza(c *caddy.Controller) (*Forward, error) {
|
||||
f := New()
|
||||
|
||||
if !c.Args(&f.from) {
|
||||
@@ -128,7 +126,7 @@ func ParseForwardStanza(c *caddyfile.Dispenser) (*Forward, error) {
|
||||
return f, nil
|
||||
}
|
||||
|
||||
func parseBlock(c *caddyfile.Dispenser, f *Forward) error {
|
||||
func parseBlock(c *caddy.Controller, f *Forward) error {
|
||||
switch c.Val() {
|
||||
case "except":
|
||||
ignore := c.RemainingArgs()
|
||||
|
||||
Reference in New Issue
Block a user