mirror of https://github.com/grpc/grpc-go.git
use insecure.NewCredentials() instead of grpc.WithInsecure (#5087)
This commit is contained in:
parent
b49c0c99e4
commit
0145b50cdc
|
@ -26,6 +26,7 @@ import (
|
|||
"time"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
pb "google.golang.org/grpc/examples/helloworld/helloworld"
|
||||
)
|
||||
|
||||
|
@ -41,7 +42,7 @@ var (
|
|||
func main() {
|
||||
flag.Parse()
|
||||
// Set up a connection to the server.
|
||||
conn, err := grpc.Dial(*addr, grpc.WithInsecure())
|
||||
conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
if err != nil {
|
||||
log.Fatalf("did not connect: %v", err)
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ import (
|
|||
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/credentials"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/examples/data"
|
||||
pb "google.golang.org/grpc/examples/route_guide/routeguide"
|
||||
)
|
||||
|
@ -164,7 +165,7 @@ func main() {
|
|||
}
|
||||
opts = append(opts, grpc.WithTransportCredentials(creds))
|
||||
} else {
|
||||
opts = append(opts, grpc.WithInsecure())
|
||||
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
}
|
||||
|
||||
conn, err := grpc.Dial(*serverAddr, opts...)
|
||||
|
|
Loading…
Reference in New Issue