You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/pkg/utils/getcd.go

19 lines
511 B

package utils
import (
"Open_IM/pkg/common/config"
"github.com/OpenIMSDK/getcdv3"
"github.com/OpenIMSDK/open_utils/constant"
"google.golang.org/grpc"
"strings"
)
func GetConn(operationID, serviceName string) (*grpc.ClientConn, error) {
conn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","),
serviceName, operationID, config.Config.Etcd.UserName, config.Config.Etcd.Password)
if conn == nil {
return nil, constant.ErrGetRpcConn
}
return conn, nil
}