Make proxy use configured WeaveDNS address

rather than assuming it is listening on the weave bridge
This commit is contained in:
Bryan Boreham committed 2018-01-29 15:55:36 +00:00
1 parent e65006042d
commit 86d2800b59
2 files changed
+3 -11

No files matched your search

+2 -11
View File
@@ -61,6 +61,7 @@ type Config struct {
NoRewriteHosts bool
TLSConfig TLSConfig
WithoutDNS bool
DNSListenAddress string
NoMulticastRoute bool
KeepTXOn bool
DockerBridge string
@@ -78,7 +79,6 @@ type Proxy struct {
Config
client *weavedocker.Client
weave *weaveapi.Client
dockerBridgeIP string
hostnameMatchRegexp *regexp.Regexp
weaveWaitVolume string
weaveWaitNoopVolume string
@@ -158,15 +158,6 @@ func NewProxy(c Config) (*Proxy, error) {
Log.Info(p.client.Info())
if !p.WithoutDNS {
ip, err := weavenet.FindBridgeIP(c.DockerBridge, nil)
if err != nil {
return nil, err
}
p.dockerBridgeIP = ip.String()
Log.Infof("Using docker bridge IP for DNS: %v", p.dockerBridgeIP)
}
p.hostnameMatchRegexp, err = regexp.Compile(c.HostnameMatch)
if err != nil {
err := fmt.Errorf("Incorrect hostname match '%s': %s", c.HostnameMatch, err.Error())
@@ -595,7 +586,7 @@ func (proxy *Proxy) setWeaveDNS(hostConfig jsonObject, hostname, dnsDomain strin
if err != nil {
return err
}
hostConfig["Dns"] = append(dns, proxy.dockerBridgeIP)
hostConfig["Dns"] = append(dns, proxy.DNSListenAddress)
dnsSearch, err := hostConfig.StringArray("DnsSearch")
if err != nil {