aboutsummaryrefslogtreecommitdiff
path: root/weed/pb/grpc_client_server.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-09-07 02:30:25 -0700
committerChris Lu <chris.lu@gmail.com>2021-09-07 02:30:25 -0700
commit889a39a24f43f8100a29cf6e6217928828dce5d0 (patch)
treec21526c008161c74ecff0b8e34e9ceec9cdd4f21 /weed/pb/grpc_client_server.go
parent85a2046411d6657d23216472cee3c112ca2231d8 (diff)
downloadseaweedfs-889a39a24f43f8100a29cf6e6217928828dce5d0.tar.xz
seaweedfs-889a39a24f43f8100a29cf6e6217928828dce5d0.zip
ipv6
Diffstat (limited to 'weed/pb/grpc_client_server.go')
-rw-r--r--weed/pb/grpc_client_server.go7
1 files changed, 4 insertions, 3 deletions
diff --git a/weed/pb/grpc_client_server.go b/weed/pb/grpc_client_server.go
index 8543df366..3a3dd0589 100644
--- a/weed/pb/grpc_client_server.go
+++ b/weed/pb/grpc_client_server.go
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/chrislusf/seaweedfs/weed/glog"
"math/rand"
+ "net"
"net/http"
"strconv"
"strings"
@@ -158,7 +159,7 @@ func ParseServerAddress(server string, deltaPort int) (newServerAddress string,
newPort := int(port) + deltaPort
- return fmt.Sprintf("%s:%d", host, newPort), nil
+ return net.JoinHostPort(host, strconv.Itoa(newPort)), nil
}
func hostAndPort(address string) (host string, port uint64, err error) {
@@ -183,7 +184,7 @@ func ServerToGrpcAddress(server string) (serverGrpcAddress string) {
grpcPort := int(port) + 10000
- return fmt.Sprintf("%s:%d", host, grpcPort)
+ return net.JoinHostPort(host, strconv.Itoa(grpcPort))
}
func GrpcAddressToServerAddress(grpcAddress string) (serverAddress string) {
@@ -194,7 +195,7 @@ func GrpcAddressToServerAddress(grpcAddress string) (serverAddress string) {
port := int(grpcPort) - 10000
- return fmt.Sprintf("%s:%d", host, port)
+ return net.JoinHostPort(host, strconv.Itoa(port))
}
func WithMasterClient(master string, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) error {