add initial advertise(Addr|Port) support
(cherry picked from commit 2a0b4f335eb54caa19ad908cdc441d73b57d68ca)
This commit is contained in:
@ -31,7 +31,7 @@ type Cluster struct {
|
||||
|
||||
// New is used to create a new Cluster instance
|
||||
// The returned instance is ready to be updated with the local node settings then joined
|
||||
func New(name string, init bool, clusterKey []byte, bindAddr string, bindPort int, useIPAsName bool) (*Cluster, error) {
|
||||
func New(name string, init bool, clusterKey []byte, bindAddr string, bindPort int, advertiseAddr string, advertisePort int, useIPAsName bool) (*Cluster, error) {
|
||||
state := &state{}
|
||||
if !init {
|
||||
loadState(state, name)
|
||||
@ -47,7 +47,8 @@ func New(name string, init bool, clusterKey []byte, bindAddr string, bindPort in
|
||||
mlConfig.SecretKey = clusterKey
|
||||
mlConfig.BindAddr = bindAddr
|
||||
mlConfig.BindPort = bindPort
|
||||
mlConfig.AdvertisePort = bindPort
|
||||
mlConfig.AdvertiseAddr = advertiseAddr
|
||||
mlConfig.AdvertisePort = advertisePort
|
||||
if useIPAsName && bindAddr != "0.0.0.0" {
|
||||
mlConfig.Name = bindAddr
|
||||
}
|
||||
|
Reference in New Issue
Block a user