mirror of
https://github.com/coredns/coredns.git
synced 2025-11-17 17:32:18 -05:00
Plugin/BIND - extend the syntax to allow multiple addresses (#1512)
* Extend bind to allow multiple addresses. UTs added. Changes the log for server starting, adding address when available * update readme for bind * fixes after review * minor fix on readme * accept multiple BIND directives in blocserver, consolidate the addresses * fixes after review - format logging server address, variable names
This commit is contained in:
committed by
Miek Gieben
parent
a0834b1dd5
commit
76455c6a0d
@@ -70,9 +70,10 @@ func (h *dnsContext) InspectServerBlocks(sourceFile string, serverBlocks []caddy
|
||||
|
||||
// Save the config to our master list, and key it for lookups.
|
||||
cfg := &Config{
|
||||
Zone: za.Zone,
|
||||
Port: za.Port,
|
||||
Transport: za.Transport,
|
||||
Zone: za.Zone,
|
||||
Port: za.Port,
|
||||
Transport: za.Transport,
|
||||
ListenHosts: []string{""},
|
||||
}
|
||||
if za.IPNet == nil {
|
||||
h.saveConfig(za.String(), cfg)
|
||||
@@ -191,14 +192,15 @@ func groupConfigsByListenAddr(configs []*Config) (map[string][]*Config, error) {
|
||||
groups := make(map[string][]*Config)
|
||||
|
||||
for _, conf := range configs {
|
||||
addr, err := net.ResolveTCPAddr("tcp", net.JoinHostPort(conf.ListenHost, conf.Port))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
for _, h := range conf.ListenHosts {
|
||||
addr, err := net.ResolveTCPAddr("tcp", net.JoinHostPort(h, conf.Port))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
addrstr := conf.Transport + "://" + addr.String()
|
||||
groups[addrstr] = append(groups[addrstr], conf)
|
||||
}
|
||||
addrstr := conf.Transport + "://" + addr.String()
|
||||
groups[addrstr] = append(groups[addrstr], conf)
|
||||
}
|
||||
|
||||
return groups, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user