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:
4
etcd.go
4
etcd.go
@ -52,8 +52,8 @@ func init() {
|
|||||||
flag.StringVar(&argInfo.Name, "n", "default-name", "the node name (required)")
|
flag.StringVar(&argInfo.Name, "n", "default-name", "the node name (required)")
|
||||||
flag.StringVar(&argInfo.EtcdURL, "c", "127.0.0.1:4001", "the advertised public hostname:port for etcd client communication")
|
flag.StringVar(&argInfo.EtcdURL, "c", "127.0.0.1:4001", "the advertised public hostname:port for etcd client communication")
|
||||||
flag.StringVar(&argInfo.RaftURL, "s", "127.0.0.1:7001", "the advertised public hostname:port for raft server communication")
|
flag.StringVar(&argInfo.RaftURL, "s", "127.0.0.1:7001", "the advertised public hostname:port for raft server communication")
|
||||||
flag.StringVar(&argInfo.EtcdListenHost, "cl", "127.0.0.1", "the listening hostname for etcd client communication")
|
flag.StringVar(&argInfo.EtcdListenHost, "cl", "", "the listening hostname for etcd client communication (defaults to advertised ip)")
|
||||||
flag.StringVar(&argInfo.RaftListenHost, "sl", "127.0.0.1", "the listening hostname for raft server communication")
|
flag.StringVar(&argInfo.RaftListenHost, "sl", "", "the listening hostname for raft server communication (defaults to advertised ip)")
|
||||||
flag.StringVar(&argInfo.WebURL, "w", "", "the hostname:port of web interface")
|
flag.StringVar(&argInfo.WebURL, "w", "", "the hostname:port of web interface")
|
||||||
|
|
||||||
flag.StringVar(&argInfo.RaftTLS.CAFile, "serverCAFile", "", "the path of the CAFile")
|
flag.StringVar(&argInfo.RaftTLS.CAFile, "serverCAFile", "", "the path of the CAFile")
|
||||||
|
7
util.go
7
util.go
@ -114,11 +114,16 @@ func sanitizeListenHost(listen string, advertised string) string {
|
|||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, aport, err := net.SplitHostPort(aurl.Host)
|
ahost, aport, err := net.SplitHostPort(aurl.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fatal(err)
|
fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If the listen host isn't set use the advertised host
|
||||||
|
if listen == "" {
|
||||||
|
listen = ahost
|
||||||
|
}
|
||||||
|
|
||||||
return net.JoinHostPort(listen, aport)
|
return net.JoinHostPort(listen, aport)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user