handle ipv6 addresses
This commit is contained in:
@@ -412,7 +412,7 @@ func (fs *FilerServer) KeepConnected(stream filer_pb.SeaweedFiler_KeepConnectedS
|
||||
return err
|
||||
}
|
||||
|
||||
clientName := fmt.Sprintf("%s:%d", req.Name, req.GrpcPort)
|
||||
clientName := util.JoinHostPort(req.Name, int(req.GrpcPort))
|
||||
m := make(map[string]bool)
|
||||
for _, tp := range req.Resources {
|
||||
m[tp] = true
|
||||
|
||||
@@ -143,7 +143,7 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, option *FilerOption)
|
||||
readonlyMux.HandleFunc("/", fs.readonlyFilerHandler)
|
||||
}
|
||||
|
||||
fs.filer.AggregateFromPeers(fmt.Sprintf("%s:%d", option.Host, option.Port), option.Filers)
|
||||
fs.filer.AggregateFromPeers(util.JoinHostPort(option.Host, int(option.Port)), option.Filers)
|
||||
|
||||
fs.filer.LoadBuckets()
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ package weed_server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/backend"
|
||||
"github.com/chrislusf/seaweedfs/weed/util"
|
||||
"net"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -289,7 +289,7 @@ func findClientAddress(ctx context.Context, grpcPort uint32) string {
|
||||
}
|
||||
if tcpAddr, ok := pr.Addr.(*net.TCPAddr); ok {
|
||||
externalIP := tcpAddr.IP
|
||||
return fmt.Sprintf("%s:%d", externalIP, grpcPort)
|
||||
return util.JoinHostPort(externalIP.String(), int(grpcPort))
|
||||
}
|
||||
return pr.Addr.String()
|
||||
|
||||
|
||||
@@ -224,7 +224,7 @@ func (ms *MasterServer) startAdminScripts() {
|
||||
scriptLines = append(scriptLines, "unlock")
|
||||
}
|
||||
|
||||
masterAddress := fmt.Sprintf("%s:%d", ms.option.Host, ms.option.Port)
|
||||
masterAddress := util.JoinHostPort(ms.option.Host, ms.option.Port)
|
||||
|
||||
var shellOptions shell.ShellOptions
|
||||
shellOptions.GrpcDialOption = security.LoadClientTLS(v, "grpc.master")
|
||||
@@ -299,7 +299,7 @@ func (ms *MasterServer) createSequencer(option *MasterOption) sequence.Sequencer
|
||||
case "snowflake":
|
||||
var err error
|
||||
snowflakeId := v.GetInt(SequencerSnowflakeId)
|
||||
seq, err = sequence.NewSnowflakeSequencer(fmt.Sprintf("%s:%d", option.Host, option.Port), snowflakeId)
|
||||
seq, err = sequence.NewSnowflakeSequencer(util.JoinHostPort(option.Host, option.Port), snowflakeId)
|
||||
if err != nil {
|
||||
glog.Error(err)
|
||||
seq = nil
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package weed_server
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||
"net/http"
|
||||
"sync"
|
||||
@@ -113,7 +112,7 @@ func NewVolumeServer(adminMux, publicMux *http.ServeMux, ip string,
|
||||
}
|
||||
|
||||
go vs.heartbeat()
|
||||
go stats.LoopPushingMetric("volumeServer", fmt.Sprintf("%s:%d", ip, port), vs.metricsAddress, vs.metricsIntervalSec)
|
||||
go stats.LoopPushingMetric("volumeServer", util.JoinHostPort(ip, port), vs.metricsAddress, vs.metricsIntervalSec)
|
||||
|
||||
return vs
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user