diff --git a/pkg/triple/dubbo3_client.go b/pkg/triple/dubbo3_client.go index 57152a1..dc58fc5 100644 --- a/pkg/triple/dubbo3_client.go +++ b/pkg/triple/dubbo3_client.go @@ -30,6 +30,7 @@ import ( "github.com/dubbogo/grpc-go" "github.com/dubbogo/grpc-go/codes" "github.com/dubbogo/grpc-go/credentials" + "github.com/dubbogo/grpc-go/credentials/insecure" "github.com/dubbogo/grpc-go/encoding" "github.com/dubbogo/grpc-go/encoding/hessian" "github.com/dubbogo/grpc-go/encoding/msgpack" @@ -96,6 +97,8 @@ func NewTripleClient(impl interface{}, opt *config.Option) (*TripleClient, error return nil, err } else if creds != nil { dialOpts = append(dialOpts, grpc.WithTransportCredentials(creds)) + } else { + dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials())) } defaultCallOpts := make([]grpc.CallOption, 0) diff --git a/pkg/triple/dubbo3_conn.go b/pkg/triple/dubbo3_conn.go index 1c821df..453e478 100644 --- a/pkg/triple/dubbo3_conn.go +++ b/pkg/triple/dubbo3_conn.go @@ -64,7 +64,6 @@ func newTripleConn(timeout time.Duration, address string, opts ...grpc.DialOptio //grpcConn, _ := grpc.Dial(address,grpc.WithInsecure()) ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - opts = append(opts, grpc.WithInsecure()) grpcConn, _ := grpc.DialContext(ctx, address, opts...) return &TripleConn{ timeout: timeout, diff --git a/pkg/triple/dubbo3_server.go b/pkg/triple/dubbo3_server.go index cbeee42..7d792d1 100644 --- a/pkg/triple/dubbo3_server.go +++ b/pkg/triple/dubbo3_server.go @@ -32,6 +32,7 @@ import ( hessian "github.com/apache/dubbo-go-hessian2" "github.com/dubbogo/grpc-go" + "github.com/dubbogo/grpc-go/credentials/insecure" "github.com/dubbogo/grpc-go/encoding" hessianGRPCCodec "github.com/dubbogo/grpc-go/encoding/hessian" "github.com/dubbogo/grpc-go/encoding/msgpack" @@ -227,6 +228,8 @@ func newGrpcServerWithCodec(opt *config.Option) *grpc.Server { } } else if creds != nil { serverOpts = append(serverOpts, grpc.Creds(creds)) + } else { + serverOpts = append(serverOpts, grpc.Creds(insecure.NewCredentials())) } var err error