mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-05-10 01:27:50 +08:00
ipv6
This commit is contained in:
parent
85a2046411
commit
889a39a24f
@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/chrislusf/seaweedfs/weed/glog"
|
"github.com/chrislusf/seaweedfs/weed/glog"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -158,7 +159,7 @@ func ParseServerAddress(server string, deltaPort int) (newServerAddress string,
|
|||||||
|
|
||||||
newPort := int(port) + deltaPort
|
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) {
|
func hostAndPort(address string) (host string, port uint64, err error) {
|
||||||
@ -183,7 +184,7 @@ func ServerToGrpcAddress(server string) (serverGrpcAddress string) {
|
|||||||
|
|
||||||
grpcPort := int(port) + 10000
|
grpcPort := int(port) + 10000
|
||||||
|
|
||||||
return fmt.Sprintf("%s:%d", host, grpcPort)
|
return net.JoinHostPort(host, strconv.Itoa(grpcPort))
|
||||||
}
|
}
|
||||||
|
|
||||||
func GrpcAddressToServerAddress(grpcAddress string) (serverAddress string) {
|
func GrpcAddressToServerAddress(grpcAddress string) (serverAddress string) {
|
||||||
@ -194,7 +195,7 @@ func GrpcAddressToServerAddress(grpcAddress string) (serverAddress string) {
|
|||||||
|
|
||||||
port := int(grpcPort) - 10000
|
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 {
|
func WithMasterClient(master string, grpcDialOption grpc.DialOption, fn func(client master_pb.SeaweedClient) error) error {
|
||||||
|
Loading…
Reference in New Issue
Block a user