mirror of
https://github.com/coredns/coredns.git
synced 2025-10-27 08:14:18 -04:00
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:
committed by
Miek Gieben
parent
fc1d73ffa9
commit
ba573c0f40
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user