Browse Source

fix insecure

pull/251/head
yedf2 4 years ago
parent
commit
c67780516f
  1. 3
      dtmgrpc/dtmgimp/grpc_clients.go
  2. 3
      test/busi/base_grpc.go

3
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

3
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")

Loading…
Cancel
Save