mirror of
https://github.com/coredns/coredns.git
synced 2025-12-06 18:35:11 -05:00
middleware/{file, auto}: resolve external CNAMEs
Do the same thing as in etcd and give the option of externally resolving CNAME. This is needed when CoreDNS is a proxy as well is serving zones.
This commit is contained in:
@@ -2,6 +2,7 @@ package auto
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
@@ -12,6 +13,7 @@ import (
|
||||
"github.com/miekg/coredns/middleware"
|
||||
"github.com/miekg/coredns/middleware/file"
|
||||
"github.com/miekg/coredns/middleware/metrics"
|
||||
"github.com/miekg/coredns/middleware/proxy"
|
||||
|
||||
"github.com/mholt/caddy"
|
||||
)
|
||||
@@ -142,6 +144,19 @@ func autoParse(c *caddy.Controller) (Auto, error) {
|
||||
case "no_reload":
|
||||
a.loader.noReload = true
|
||||
|
||||
case "upstream":
|
||||
args := c.RemainingArgs()
|
||||
if len(args) == 0 {
|
||||
return a, false, c.ArgErr()
|
||||
}
|
||||
for i := 0; i < len(args); i++ {
|
||||
h, p, e := net.SplitHostPort(args[i])
|
||||
if e != nil && p == "" {
|
||||
args[i] = h + ":53"
|
||||
}
|
||||
}
|
||||
a.loader.Proxy = proxy.New(args)
|
||||
|
||||
default:
|
||||
t, _, e := file.TransferParse(c, false)
|
||||
if e != nil {
|
||||
|
||||
Reference in New Issue
Block a user