mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-03 02:42:19 +08:00
feat: direct conn with multiple ports
This commit is contained in:
parent
2fd61980c0
commit
632e51c768
@ -7,6 +7,7 @@ import (
|
||||
"github.com/OpenIMSDK/tools/errs"
|
||||
config2 "github.com/openimsdk/open-im-server/v3/pkg/common/config"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"net"
|
||||
"time"
|
||||
)
|
||||
@ -27,7 +28,6 @@ func getServiceAddresses() ServiceAddresses {
|
||||
}
|
||||
}
|
||||
|
||||
// fmt.Sprintf(config2.Config.Rpc.ListenIP+":%d", config2.Config.RpcPort.OpenImUserPort[0])
|
||||
type ConnDirect struct {
|
||||
additionalOpts []grpc.DialOption
|
||||
currentServiceAddress string
|
||||
@ -137,7 +137,7 @@ func (cd *ConnDirect) CloseConn(conn *grpc.ClientConn) {
|
||||
}
|
||||
|
||||
func (cd *ConnDirect) dialService(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
|
||||
options := append(opts, grpc.WithInsecure()) // Replace WithInsecure with proper security options
|
||||
options := append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
conn, err := grpc.DialContext(ctx, cd.resolverDirect.Scheme()+":///"+address, options...)
|
||||
|
||||
if err != nil {
|
||||
@ -146,7 +146,7 @@ func (cd *ConnDirect) dialService(ctx context.Context, address string, opts ...g
|
||||
return conn, nil
|
||||
}
|
||||
func (cd *ConnDirect) dialServiceWithoutResolver(ctx context.Context, address string, opts ...grpc.DialOption) (*grpc.ClientConn, error) {
|
||||
options := append(opts, grpc.WithInsecure()) // Replace WithInsecure with proper security options
|
||||
options := append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
conn, err := grpc.DialContext(ctx, address, options...)
|
||||
|
||||
if err != nil {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user