AlexStocks commented on code in PR #3231:
URL: https://github.com/apache/dubbo-go/pull/3231#discussion_r2899090807
##########
protocol/grpc/client.go:
##########
@@ -93,24 +88,10 @@ func NewClient(url *common.URL) (*Client, error) {
grpc.MaxCallRecvMsgSize(maxCallRecvMsgSize),
grpc.MaxCallSendMsgSize(maxCallSendMsgSize),
),
+ grpc.WithTransportCredentials(insecure.NewCredentials()),
Review Comment:
`insecure.NewCredentials()` 被无条件加入 `dialOpts`,之后若命中 TLS 分支,又 append 了
`credentials.NewTLS(cfg)`。gRPC 不允许同一连接同时配置两套 transport credentials,TLS
场景**完全失效**。原代码是互斥的 `else if ... else` 结构,PR 把互斥性破坏了。`server.go` 存在同样问题。
建议恢复互斥结构:
```go
if tlsConfRaw, ok := url.GetAttribute(constant.TLSConfigKey); ok {
// TLS 路径
} else {
dialOpts = append(dialOpts,
grpc.WithTransportCredentials(insecure.NewCredentials()))
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]