feat(etcd): Default server listen and client listen to advertised IPs

Map the advertised IP to the listening IP by default. This will make
things nicer for the user.
This commit is contained in:
Brandon Philips
2013-08-31 21:53:08 -07:00
parent 0166edce77
commit bfeed190ea
2 changed files with 8 additions and 3 deletions

View File

@ -114,11 +114,16 @@ func sanitizeListenHost(listen string, advertised string) string {
fatal(err)
}
_, aport, err := net.SplitHostPort(aurl.Host)
ahost, aport, err := net.SplitHostPort(aurl.Host)
if err != nil {
fatal(err)
}
// If the listen host isn't set use the advertised host
if listen == "" {
listen = ahost
}
return net.JoinHostPort(listen, aport)
}