plugin/auto/file/secondary: Use new upstream resolver (#1534)

* move file, auto, secondary to new upstream

* include context in request
This commit is contained in:
Chris O'Haver
2018-02-16 03:44:50 -05:00
committed by Miek Gieben
parent fc1d73ffa9
commit ba573c0f40
12 changed files with 30 additions and 36 deletions

View File

@@ -6,9 +6,8 @@ import (
"github.com/coredns/coredns/core/dnsserver"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/dnsutil"
"github.com/coredns/coredns/plugin/pkg/parse"
"github.com/coredns/coredns/plugin/proxy"
"github.com/coredns/coredns/plugin/pkg/upstream"
"github.com/mholt/caddy"
)
@@ -90,7 +89,7 @@ func fileParse(c *caddy.Controller) (Zones, error) {
}
noReload := false
prxy := proxy.Proxy{}
upstr := upstream.Upstream{}
t := []string{}
var e error
@@ -107,14 +106,11 @@ func fileParse(c *caddy.Controller) (Zones, error) {
case "upstream":
args := c.RemainingArgs()
if len(args) == 0 {
return Zones{}, c.ArgErr()
}
ups, err := dnsutil.ParseHostPortOrFile(args...)
upstr, err = upstream.NewUpstream(args)
if err != nil {
return Zones{}, err
}
prxy = proxy.NewLookup(ups)
default:
return Zones{}, c.Errf("unknown property '%s'", c.Val())
}
@@ -124,7 +120,7 @@ func fileParse(c *caddy.Controller) (Zones, error) {
z[origin].TransferTo = append(z[origin].TransferTo, t...)
}
z[origin].NoReload = noReload
z[origin].Proxy = prxy
z[origin].Upstream = upstr
}
}
}