Node TLS mux needs to use advertised Raft address
@@ -267,17 +267,17 @@ func startHTTPService(cfg *Config, str *store.Store, cltr *cluster.Client, credS
// startNodeMux starts the TCP mux on the given listener, which should be already
// bound to the relevant interface.
func startNodeMux(cfg *Config, ln net.Listener) (*tcp.Mux, error) {
- var adv net.Addr
var err error
+ adv := tcp.NameAddress{
+ Address: cfg.RaftAdv,
+ }
var mux *tcp.Mux
if cfg.NodeEncrypt {
log.Printf("enabling node-to-node encryption with cert: %s, key: %s", cfg.NodeX509Cert, cfg.NodeX509Key)
mux, err = tcp.NewTLSMux(ln, adv, cfg.NodeX509Cert, cfg.NodeX509Key, cfg.NodeX509CACert)
} else {
- mux, err = tcp.NewMux(ln, tcp.NameAddress{
- Address: cfg.RaftAdv,
- })
+ mux, err = tcp.NewMux(ln, adv)
}
if err != nil {
return nil, fmt.Errorf("failed to create node-to-node mux: %s", err.Error())
