From c67780516f3b98f6a1532c389604e734ff177a26 Mon Sep 17 00:00:00 2001 From: yedf2 <120050102@qq.com> Date: Thu, 3 Mar 2022 11:59:50 +0800 Subject: [PATCH] fix insecure --- dtmgrpc/dtmgimp/grpc_clients.go | 3 ++- test/busi/base_grpc.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/dtmgrpc/dtmgimp/grpc_clients.go b/dtmgrpc/dtmgimp/grpc_clients.go index 74c30ce..dc98848 100644 --- a/dtmgrpc/dtmgimp/grpc_clients.go +++ b/dtmgrpc/dtmgimp/grpc_clients.go @@ -14,6 +14,7 @@ import ( "github.com/dtm-labs/dtm/dtmcli/logger" "github.com/dtm-labs/dtm/dtmgrpc/dtmgpb" grpc "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) type rawCodec struct{} @@ -58,7 +59,7 @@ func GetGrpcConn(grpcServer string, isRaw bool) (conn *grpc.ClientConn, rerr err logger.Debugf("grpc client connecting %s", grpcServer) interceptors := append(ClientInterceptors, GrpcClientLog) inOpt := grpc.WithChainUnaryInterceptor(interceptors...) - conn, rerr := grpc.Dial(grpcServer, inOpt, grpc.WithInsecure(), opts) + conn, rerr := grpc.Dial(grpcServer, inOpt, grpc.WithTransportCredentials(insecure.NewCredentials()), opts) if rerr == nil { clients.Store(grpcServer, conn) v = conn diff --git a/test/busi/base_grpc.go b/test/busi/base_grpc.go index 682c37d..cb1032f 100644 --- a/test/busi/base_grpc.go +++ b/test/busi/base_grpc.go @@ -23,6 +23,7 @@ import ( "github.com/dtm-labs/dtm/dtmgrpc/dtmgimp" "github.com/dtm-labs/dtm/dtmgrpc/dtmgpb" grpc "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" emptypb "google.golang.org/protobuf/types/known/emptypb" ) @@ -43,7 +44,7 @@ func init() { // GrpcStartup for grpc func GrpcStartup() { - conn, err := grpc.Dial(dtmutil.DefaultGrpcServer, grpc.WithInsecure(), grpc.WithUnaryInterceptor(dtmgimp.GrpcClientLog)) + conn, err := grpc.Dial(dtmutil.DefaultGrpcServer, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithUnaryInterceptor(dtmgimp.GrpcClientLog)) logger.FatalIfError(err) DtmClient = dtmgpb.NewDtmClient(conn) logger.Debugf("dtm client inited")