diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-09-07 19:29:42 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-09-07 19:29:42 -0700 |
| commit | 574485ec69c1d1a7be8765f5da24d9c23803cb96 (patch) | |
| tree | 2a47c75dd4d8ff84a39eaf2548ba0989c659c07e /weed/command/master.go | |
| parent | 0128239c0f8829bb20edd1df257840dcbfa37c0e (diff) | |
| download | seaweedfs-574485ec69c1d1a7be8765f5da24d9c23803cb96.tar.xz seaweedfs-574485ec69c1d1a7be8765f5da24d9c23803cb96.zip | |
better IP v6 support
Diffstat (limited to 'weed/command/master.go')
| -rw-r--r-- | weed/command/master.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/weed/command/master.go b/weed/command/master.go index 4eb43ee09..2605f6f4b 100644 --- a/weed/command/master.go +++ b/weed/command/master.go @@ -7,7 +7,6 @@ import ( "net/http" "os" "sort" - "strconv" "strings" "time" @@ -116,7 +115,7 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) { r := mux.NewRouter() ms := weed_server.NewMasterServer(r, masterOption.toMasterOption(masterWhiteList), peers) - listeningAddress := *masterOption.ipBind + ":" + strconv.Itoa(*masterOption.port) + listeningAddress := util.JoinHostPort(*masterOption.ipBind, *masterOption.port) glog.V(0).Infof("Start Seaweed Master %s at %s", util.Version(), listeningAddress) masterListener, e := util.NewListener(listeningAddress, 0) if e != nil { @@ -132,7 +131,7 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) { r.HandleFunc("/cluster/status", raftServer.StatusHandler).Methods("GET") // starting grpc server grpcPort := *masterOption.port + 10000 - grpcL, err := util.NewListener(*masterOption.ipBind+":"+strconv.Itoa(grpcPort), 0) + grpcL, err := util.NewListener(util.JoinHostPort(*masterOption.ipBind, grpcPort), 0) if err != nil { glog.Fatalf("master failed to listen on grpc port %d: %v", grpcPort, err) } @@ -163,7 +162,7 @@ func startMaster(masterOption MasterOptions, masterWhiteList []string) { func checkPeers(masterIp string, masterPort int, peers string) (masterAddress string, cleanedPeers []string) { glog.V(0).Infof("current: %s:%d peers:%s", masterIp, masterPort, peers) - masterAddress = masterIp + ":" + strconv.Itoa(masterPort) + masterAddress = util.JoinHostPort(masterIp, masterPort) if peers != "" { cleanedPeers = strings.Split(peers, ",") } |
