嘿,我正在尝试使用 Go 和 Grpc 制作一个小型测试客户端,
opts := grpc.WithInsecure()
cc, err := grpc.Dial("localhost:9950", opts)
if err != nil {
log.Fatal(err)
}
Run Code Online (Sandbox Code Playgroud)
函数WithInsecure()调用给出警告:
grpc.WithInsecure 已弃用:使用 insecure.NewCredentials() 代替。
我不确定如何使用这个新函数调用,某处有示例吗?谢谢
bla*_*een 70
该函数insecure.NewCredentials返回 的实现credentials.TransportCredentials。
您可以将它用作DialOptionwith grpc.WithTransportCredentials:
grpc.Dial(":9950", grpc.WithTransportCredentials(insecure.NewCredentials()))
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19344 次 |
| 最近记录: |