Fetch DNS listen address from daemon

instead of assuming it's on the Docker bridge

Also move DNS address validation into NewDNSServer(),
so we only do it once.
This commit is contained in:
Bryan Boreham committed 2020-07-31 11:58:56 +00:00
1 parent 00623be8a7
commit b0274e11be
5 files changed
+27 -9

No files matched your search

+2 -4
View File
@@ -55,10 +55,7 @@ type dnsConfig struct {
// return the address part of the DNS listen address, without ":53" on the end
func (c dnsConfig) addressOnly() string {
addr, _, err := net.SplitHostPort(c.ListenAddress)
if err != nil {
Log.Fatalf("Error when parsing DNS listen address %q: %s", c.ListenAddress, err)
}
addr, _, _ := net.SplitHostPort(c.ListenAddress)
return addr
}
@@ -474,6 +471,7 @@ func main() {
}
if ns != nil {
ns.HandleHTTP(muxRouter, dockerCli)
dnsserver.HandleHTTP(muxRouter)
}
router.HandleHTTP(muxRouter)
HandleHTTP(muxRouter, version, router, allocator, defaultSubnet, ns, dnsserver, proxy, plugin, &waitReady)