Skip to content

Commit 9001268

Browse files
authored
Merge pull request #50 from ZLBer/tls_support
fix: tls support
2 parents d67d6b8 + 83edc5c commit 9001268

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

pkg/triple/dubbo3_client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import (
3030
"github.com/dubbogo/grpc-go"
3131
"github.com/dubbogo/grpc-go/codes"
3232
"github.com/dubbogo/grpc-go/credentials"
33+
"github.com/dubbogo/grpc-go/credentials/insecure"
3334
"github.com/dubbogo/grpc-go/encoding"
3435
"github.com/dubbogo/grpc-go/encoding/hessian"
3536
"github.com/dubbogo/grpc-go/encoding/msgpack"
@@ -96,6 +97,8 @@ func NewTripleClient(impl interface{}, opt *config.Option) (*TripleClient, error
9697
return nil, err
9798
} else if creds != nil {
9899
dialOpts = append(dialOpts, grpc.WithTransportCredentials(creds))
100+
} else {
101+
dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))
99102
}
100103

101104
defaultCallOpts := make([]grpc.CallOption, 0)

pkg/triple/dubbo3_conn.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ func newTripleConn(timeout time.Duration, address string, opts ...grpc.DialOptio
6464
//grpcConn, _ := grpc.Dial(address,grpc.WithInsecure())
6565
ctx, cancel := context.WithTimeout(context.Background(), timeout)
6666
defer cancel()
67-
opts = append(opts, grpc.WithInsecure())
6867
grpcConn, _ := grpc.DialContext(ctx, address, opts...)
6968
return &TripleConn{
7069
timeout: timeout,

pkg/triple/dubbo3_server.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
hessian "github.com/apache/dubbo-go-hessian2"
3333

3434
"github.com/dubbogo/grpc-go"
35+
"github.com/dubbogo/grpc-go/credentials/insecure"
3536
"github.com/dubbogo/grpc-go/encoding"
3637
hessianGRPCCodec "github.com/dubbogo/grpc-go/encoding/hessian"
3738
"github.com/dubbogo/grpc-go/encoding/msgpack"
@@ -227,6 +228,8 @@ func newGrpcServerWithCodec(opt *config.Option) *grpc.Server {
227228
}
228229
} else if creds != nil {
229230
serverOpts = append(serverOpts, grpc.Creds(creds))
231+
} else {
232+
serverOpts = append(serverOpts, grpc.Creds(insecure.NewCredentials()))
230233
}
231234

232235
var err error

0 commit comments

Comments
 (0)