Fix grpc.Dial usage in sshpiperd (#436)

* Fix grpc.Dial usage in sshpiperd

* fix dns not found

* Update dependencies in go.mod and go.sum files

* Refactor grpc.NewClient to remove unnecessary grpc.WithBlock() option
This commit is contained in:
Boshi Lian 2024-10-18 01:01:58 -07:00 • committed by GitHub
parent 57d0e21787
commit 08d0e23d60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 31 additions and 37 deletions

View file

@ -80,7 +80,7 @@ func createNetGrpcPlugin(args []string) (grpcPlugin *plugin.GrpcPlugin, err erro
secopt = grpc.WithTransportCredentials(credentials.NewTLS(config))
}
conn, err := grpc.Dial(c.String("endpoint"), secopt, grpc.WithBlock())
conn, err := grpc.NewClient(c.String("endpoint"), secopt)
if err != nil {
return err
}

View file

@ -576,7 +576,8 @@ func DialCmd(cmd *exec.Cmd) (*CmdPlugin, error) {
ch <- cmd.Wait()
}()
conn, err := grpc.Dial("", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(_ context.Context, _ string) (net.Conn, error) {
// this dummy 127.0.0.1 is not used
conn, err := grpc.NewClient("127.0.0.1", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(_ context.Context, _ string) (net.Conn, error) {
return cmdconn, nil
}))