diff --git a/admin/test/utils.go b/admin/test/utils.go index 1add8afa824c..6540797ff2ba 100644 --- a/admin/test/utils.go +++ b/admin/test/utils.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc/admin" channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/xds" "google.golang.org/grpc/status" ) @@ -78,7 +79,7 @@ func RunRegisterTests(t *testing.T, ec ExpectedStatusCodes) { server.Serve(lis) }() - conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("cannot connect to server: %v", err) } diff --git a/authz/sdk_end2end_test.go b/authz/sdk_end2end_test.go index b3d449d5dfbd..db871147f8aa 100644 --- a/authz/sdk_end2end_test.go +++ b/authz/sdk_end2end_test.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc/authz" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/grpctest" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" @@ -324,7 +325,7 @@ func (s) TestSDKStaticPolicyEnd2End(t *testing.T) { go s.Serve(lis) // Establish a connection to the server. - clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err) } @@ -514,7 +515,7 @@ func (s) TestSDKFileWatcherEnd2End(t *testing.T) { go s.Serve(lis) // Establish a connection to the server. - clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err) } @@ -583,7 +584,7 @@ func (s) TestSDKFileWatcher_ValidPolicyRefresh(t *testing.T) { go s.Serve(lis) // Establish a connection to the server. - clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err) } @@ -631,7 +632,7 @@ func (s) TestSDKFileWatcher_InvalidPolicySkipReload(t *testing.T) { go s.Serve(lis) // Establish a connection to the server. - clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err) } @@ -682,7 +683,7 @@ func (s) TestSDKFileWatcher_RecoversFromReloadFailure(t *testing.T) { go s.Serve(lis) // Establish a connection to the server. - clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + clientConn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("grpc.Dial(%v) failed: %v", lis.Addr().String(), err) } diff --git a/balancer/grpclb/grpclb_remote_balancer.go b/balancer/grpclb/grpclb_remote_balancer.go index 330df4baa218..805bbbb789ae 100644 --- a/balancer/grpclb/grpclb_remote_balancer.go +++ b/balancer/grpclb/grpclb_remote_balancer.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc/balancer" lbpb "google.golang.org/grpc/balancer/grpclb/grpc_lb_v1" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/backoff" "google.golang.org/grpc/internal/channelz" imetadata "google.golang.org/grpc/internal/metadata" @@ -228,7 +229,7 @@ func (lb *lbBalancer) newRemoteBalancerCCWrapper() { } else if bundle := lb.grpclbClientConnCreds; bundle != nil { dopts = append(dopts, grpc.WithCredentialsBundle(bundle)) } else { - dopts = append(dopts, grpc.WithInsecure()) + dopts = append(dopts, grpc.WithTransportCredentials(insecure.NewCredentials())) } if lb.opt.Dialer != nil { dopts = append(dopts, grpc.WithContextDialer(lb.opt.Dialer)) diff --git a/balancer/rls/control_channel.go b/balancer/rls/control_channel.go index 9df96549f7dc..df78f7b55fbe 100644 --- a/balancer/rls/control_channel.go +++ b/balancer/rls/control_channel.go @@ -27,6 +27,7 @@ import ( "google.golang.org/grpc/balancer" "google.golang.org/grpc/balancer/rls/internal/adaptive" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal" internalgrpclog "google.golang.org/grpc/internal/grpclog" "google.golang.org/grpc/internal/pretty" @@ -115,7 +116,7 @@ func (cc *controlChannel) dialOpts(bOpts balancer.BuildOptions, serviceConfig st credsOpt = grpc.WithCredentialsBundle(bundle) default: cc.logger.Warningf("no credentials available, using Insecure") - credsOpt = grpc.WithInsecure() + credsOpt = grpc.WithTransportCredentials(insecure.NewCredentials()) } dopts = append(dopts, credsOpt) diff --git a/benchmark/benchmain/main.go b/benchmark/benchmain/main.go index b3655820c1cf..d9707553a688 100644 --- a/benchmark/benchmain/main.go +++ b/benchmark/benchmain/main.go @@ -63,6 +63,7 @@ import ( "google.golang.org/grpc/benchmark/flags" "google.golang.org/grpc/benchmark/latency" "google.golang.org/grpc/benchmark/stats" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/channelz" "google.golang.org/grpc/keepalive" @@ -305,7 +306,7 @@ func makeClient(bf stats.Features) (testgrpc.BenchmarkServiceClient, func()) { ) } sopts = append(sopts, grpc.MaxConcurrentStreams(uint32(bf.MaxConcurrentCalls+1))) - opts = append(opts, grpc.WithInsecure()) + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) var lis net.Listener if bf.UseBufConn { diff --git a/benchmark/client/main.go b/benchmark/client/main.go index caf2db70a501..5c615ced1409 100644 --- a/benchmark/client/main.go +++ b/benchmark/client/main.go @@ -51,6 +51,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/benchmark" "google.golang.org/grpc/benchmark/stats" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/internal/syscall" @@ -135,7 +136,7 @@ func main() { func buildConnections(ctx context.Context) []*grpc.ClientConn { ccs := make([]*grpc.ClientConn, *numConn) for i := range ccs { - ccs[i] = benchmark.NewClientConnWithContext(ctx, "localhost:"+*port, grpc.WithInsecure(), grpc.WithBlock()) + ccs[i] = benchmark.NewClientConnWithContext(ctx, "localhost:"+*port, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()) } return ccs } diff --git a/benchmark/worker/benchmark_client.go b/benchmark/worker/benchmark_client.go index c5748d7016f4..312fcfd7dc1f 100644 --- a/benchmark/worker/benchmark_client.go +++ b/benchmark/worker/benchmark_client.go @@ -31,6 +31,7 @@ import ( "google.golang.org/grpc/benchmark/stats" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/syscall" "google.golang.org/grpc/status" "google.golang.org/grpc/testdata" @@ -135,7 +136,7 @@ func createConns(config *testpb.ClientConfig) ([]*grpc.ClientConn, func(), error } opts = append(opts, grpc.WithTransportCredentials(creds)) } else { - opts = append(opts, grpc.WithInsecure()) + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) } // Use byteBufCodec if it is required. diff --git a/binarylog/binarylog_end2end_test.go b/binarylog/binarylog_end2end_test.go index adf2d1f76047..1ac0a8e7c02b 100644 --- a/binarylog/binarylog_end2end_test.go +++ b/binarylog/binarylog_end2end_test.go @@ -31,6 +31,7 @@ import ( "github.com/golang/protobuf/proto" "google.golang.org/grpc" "google.golang.org/grpc/binarylog" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/grpclog" iblog "google.golang.org/grpc/internal/binarylog" "google.golang.org/grpc/internal/grpctest" @@ -310,7 +311,7 @@ func (te *test) clientConn() *grpc.ClientConn { if te.cc != nil { return te.cc } - opts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithBlock()} + opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock()} var err error te.cc, err = grpc.Dial(te.srvAddr, opts...) diff --git a/clientconn.go b/clientconn.go index 28f09dc87073..f9af78913710 100644 --- a/clientconn.go +++ b/clientconn.go @@ -79,7 +79,7 @@ var ( // errNoTransportSecurity indicates that there is no transport security // being set for ClientConn. Users should either set one or explicitly // call WithInsecure DialOption to disable security. - errNoTransportSecurity = errors.New("grpc: no transport security set (use grpc.WithInsecure() explicitly or set credentials)") + errNoTransportSecurity = errors.New("grpc: no transport security set (use grpc.WithTransportCredentials(insecure.NewCredentials()) explicitly or set credentials)") // errTransportCredsAndBundle indicates that creds bundle is used together // with other individual Transport Credentials. errTransportCredsAndBundle = errors.New("grpc: credentials.Bundle may not be used with individual TransportCredentials") diff --git a/credentials/alts/internal/handshaker/service/service.go b/credentials/alts/internal/handshaker/service/service.go index 77d759cd956f..2de2c4affdaa 100644 --- a/credentials/alts/internal/handshaker/service/service.go +++ b/credentials/alts/internal/handshaker/service/service.go @@ -24,6 +24,7 @@ import ( "sync" grpc "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ) var ( @@ -49,7 +50,7 @@ func Dial(hsAddress string) (*grpc.ClientConn, error) { // Create a new connection to the handshaker service. Note that // this connection stays open until the application is closed. var err error - hsConn, err = hsDialer(hsAddress, grpc.WithInsecure()) + hsConn, err = hsDialer(hsAddress, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { return nil, err } diff --git a/examples/features/cancellation/client/main.go b/examples/features/cancellation/client/main.go index 58bd4b6f0180..248619f7a617 100644 --- a/examples/features/cancellation/client/main.go +++ b/examples/features/cancellation/client/main.go @@ -28,6 +28,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" pb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/status" ) @@ -55,7 +56,7 @@ 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) } diff --git a/examples/features/compression/client/main.go b/examples/features/compression/client/main.go index 4375c5d7ef93..24c3bbac1089 100644 --- a/examples/features/compression/client/main.go +++ b/examples/features/compression/client/main.go @@ -27,6 +27,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding/gzip" // Install the gzip compressor pb "google.golang.org/grpc/examples/features/proto/echo" ) @@ -37,7 +38,7 @@ 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) } diff --git a/examples/features/deadline/client/main.go b/examples/features/deadline/client/main.go index 0e2626130cec..8a4e3a2d26cc 100644 --- a/examples/features/deadline/client/main.go +++ b/examples/features/deadline/client/main.go @@ -28,6 +28,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" pb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/status" ) @@ -72,7 +73,7 @@ func streamingCall(c pb.EchoClient, requestID int, message string, want codes.Co func main() { flag.Parse() - 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) } diff --git a/examples/features/deadline/server/main.go b/examples/features/deadline/server/main.go index 11cd47a6b5b3..ce3fc61679fc 100644 --- a/examples/features/deadline/server/main.go +++ b/examples/features/deadline/server/main.go @@ -31,6 +31,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" pb "google.golang.org/grpc/examples/features/proto/echo" @@ -94,7 +95,7 @@ func (s *server) Close() { func newEchoServer() *server { target := fmt.Sprintf("localhost:%v", *port) - cc, err := grpc.Dial(target, grpc.WithInsecure()) + cc, err := grpc.Dial(target, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/examples/features/debugging/client/main.go b/examples/features/debugging/client/main.go index 373f7db08e91..09acfa8112e5 100644 --- a/examples/features/debugging/client/main.go +++ b/examples/features/debugging/client/main.go @@ -28,6 +28,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/channelz/service" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" @@ -59,7 +60,7 @@ func main() { /***** Initialize manual resolver and Dial *****/ r := manual.NewBuilderWithScheme("whatever") // Set up a connection to the server. - conn, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithResolvers(r), grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`)) + conn, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r), grpc.WithDefaultServiceConfig(`{"loadBalancingPolicy":"round_robin"}`)) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/examples/features/errors/client/main.go b/examples/features/errors/client/main.go index 4bacff5f3e5b..7f905f82bef3 100644 --- a/examples/features/errors/client/main.go +++ b/examples/features/errors/client/main.go @@ -28,6 +28,7 @@ import ( epb "google.golang.org/genproto/googleapis/rpc/errdetails" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" pb "google.golang.org/grpc/examples/helloworld/helloworld" "google.golang.org/grpc/status" ) @@ -38,7 +39,7 @@ 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) } diff --git a/examples/features/health/client/main.go b/examples/features/health/client/main.go index 9cbc03f90a47..1e44aeb3d30e 100644 --- a/examples/features/health/client/main.go +++ b/examples/features/health/client/main.go @@ -27,6 +27,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" pb "google.golang.org/grpc/examples/features/proto/echo" _ "google.golang.org/grpc/health" "google.golang.org/grpc/resolver" @@ -65,7 +66,7 @@ func main() { address := fmt.Sprintf("%s:///unused", r.Scheme()) options := []grpc.DialOption{ - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock(), grpc.WithResolvers(r), grpc.WithDefaultServiceConfig(serviceConfig), diff --git a/examples/features/keepalive/client/main.go b/examples/features/keepalive/client/main.go index a8cfbc5c4541..feb9b664bf4e 100644 --- a/examples/features/keepalive/client/main.go +++ b/examples/features/keepalive/client/main.go @@ -27,6 +27,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" pb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/keepalive" ) @@ -42,7 +43,7 @@ var kacp = keepalive.ClientParameters{ func main() { flag.Parse() - conn, err := grpc.Dial(*addr, grpc.WithInsecure(), grpc.WithKeepaliveParams(kacp)) + conn, err := grpc.Dial(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithKeepaliveParams(kacp)) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/examples/features/load_balancing/client/main.go b/examples/features/load_balancing/client/main.go index 5dd0ddfc7d08..2caecb7b3d32 100644 --- a/examples/features/load_balancing/client/main.go +++ b/examples/features/load_balancing/client/main.go @@ -26,6 +26,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ecpb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/resolver" ) @@ -58,7 +59,7 @@ func main() { // "pick_first" is the default, so there's no need to set the load balancing policy. pickfirstConn, err := grpc.Dial( fmt.Sprintf("%s:///%s", exampleScheme, exampleServiceName), - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), ) if err != nil { log.Fatalf("did not connect: %v", err) @@ -74,7 +75,7 @@ func main() { roundrobinConn, err := grpc.Dial( fmt.Sprintf("%s:///%s", exampleScheme, exampleServiceName), grpc.WithDefaultServiceConfig(`{"loadBalancingConfig": [{"round_robin":{}}]}`), // This sets the initial balancing policy. - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), ) if err != nil { log.Fatalf("did not connect: %v", err) diff --git a/examples/features/metadata/client/main.go b/examples/features/metadata/client/main.go index 3aa3a599c2dd..97e7fd40cf45 100644 --- a/examples/features/metadata/client/main.go +++ b/examples/features/metadata/client/main.go @@ -28,6 +28,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" pb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/metadata" ) @@ -286,7 +287,7 @@ const message = "this is examples/metadata" 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) } diff --git a/examples/features/multiplex/client/main.go b/examples/features/multiplex/client/main.go index e25bb7a838bb..3cd85240a335 100644 --- a/examples/features/multiplex/client/main.go +++ b/examples/features/multiplex/client/main.go @@ -27,6 +27,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ecpb "google.golang.org/grpc/examples/features/proto/echo" hwpb "google.golang.org/grpc/examples/helloworld/helloworld" ) @@ -58,7 +59,7 @@ func callUnaryEcho(client ecpb.EchoClient, message string) { 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) } diff --git a/examples/features/name_resolving/client/main.go b/examples/features/name_resolving/client/main.go index 25bd5fd46a75..ad6b310b6de7 100644 --- a/examples/features/name_resolving/client/main.go +++ b/examples/features/name_resolving/client/main.go @@ -26,6 +26,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ecpb "google.golang.org/grpc/examples/features/proto/echo" "google.golang.org/grpc/resolver" ) @@ -57,7 +58,7 @@ func makeRPCs(cc *grpc.ClientConn, n int) { func main() { passthroughConn, err := grpc.Dial( fmt.Sprintf("passthrough:///%s", backendAddr), // Dial to "passthrough:///localhost:50051" - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), ) if err != nil { log.Fatalf("did not connect: %v", err) @@ -71,7 +72,7 @@ func main() { exampleConn, err := grpc.Dial( fmt.Sprintf("%s:///%s", exampleScheme, exampleServiceName), // Dial to "example:///resolver.example.grpc.io" - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), ) if err != nil { log.Fatalf("did not connect: %v", err) diff --git a/examples/features/retry/README.md b/examples/features/retry/README.md index f56d438adc2b..826cca7f40bc 100644 --- a/examples/features/retry/README.md +++ b/examples/features/retry/README.md @@ -62,5 +62,5 @@ To use the above service config, pass it with `grpc.WithDefaultServiceConfig` to `grpc.Dial`. ```go -conn, err := grpc.Dial(ctx,grpc.WithInsecure(), grpc.WithDefaultServiceConfig(retryPolicy)) +conn, err := grpc.Dial(ctx,grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy)) ``` diff --git a/examples/features/retry/client/main.go b/examples/features/retry/client/main.go index 73147cfe0a27..3b9b80e24ba7 100644 --- a/examples/features/retry/client/main.go +++ b/examples/features/retry/client/main.go @@ -26,6 +26,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" pb "google.golang.org/grpc/examples/features/proto/echo" ) @@ -48,7 +49,7 @@ var ( // use grpc.WithDefaultServiceConfig() to set service config func retryDial() (*grpc.ClientConn, error) { - return grpc.Dial(*addr, grpc.WithInsecure(), grpc.WithDefaultServiceConfig(retryPolicy)) + return grpc.Dial(*addr, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(retryPolicy)) } func main() { diff --git a/examples/features/unix_abstract/client/main.go b/examples/features/unix_abstract/client/main.go index 96c6f82bf19b..3564e7e82fee 100644 --- a/examples/features/unix_abstract/client/main.go +++ b/examples/features/unix_abstract/client/main.go @@ -31,6 +31,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ecpb "google.golang.org/grpc/examples/features/proto/echo" ) @@ -62,7 +63,7 @@ func makeRPCs(cc *grpc.ClientConn, n int) { func main() { flag.Parse() sockAddr := fmt.Sprintf("unix-abstract:%v", *addr) - cc, err := grpc.Dial(sockAddr, grpc.WithInsecure()) + cc, err := grpc.Dial(sockAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("grpc.Dial(%q) failed: %v", sockAddr, err) } diff --git a/examples/features/wait_for_ready/main.go b/examples/features/wait_for_ready/main.go index f865410f1aa2..96524a81da32 100644 --- a/examples/features/wait_for_ready/main.go +++ b/examples/features/wait_for_ready/main.go @@ -29,6 +29,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/status" pb "google.golang.org/grpc/examples/features/proto/echo" @@ -58,7 +59,7 @@ func serve() { } func main() { - conn, err := grpc.Dial("localhost:50053", grpc.WithInsecure()) + conn, err := grpc.Dial("localhost:50053", grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { log.Fatalf("did not connect: %v", err) } diff --git a/internal/stubserver/stubserver.go b/internal/stubserver/stubserver.go index f3ed23aa32a4..482c96a83b68 100644 --- a/internal/stubserver/stubserver.go +++ b/internal/stubserver/stubserver.go @@ -28,6 +28,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/resolver" "google.golang.org/grpc/resolver/manual" "google.golang.org/grpc/serviceconfig" @@ -116,7 +117,7 @@ func (ss *StubServer) StartServer(sopts ...grpc.ServerOption) error { // StartClient creates a client connected to this service that the test may use. // The newly created client will be available in the Client field of StubServer. func (ss *StubServer) StartClient(dopts ...grpc.DialOption) error { - opts := append([]grpc.DialOption{grpc.WithInsecure()}, dopts...) + opts := append([]grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())}, dopts...) if ss.R != nil { ss.Target = ss.R.Scheme() + ":///" + ss.Address opts = append(opts, grpc.WithResolvers(ss.R)) diff --git a/interop/client/client.go b/interop/client/client.go index f41f56fbbd55..ba1598db0ee6 100644 --- a/interop/client/client.go +++ b/interop/client/client.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/alts" "google.golang.org/grpc/credentials/google" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/oauth" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/interop" @@ -176,7 +177,7 @@ func main() { case credsComputeEngineCreds: opts = append(opts, grpc.WithCredentialsBundle(google.NewComputeEngineCredentials())) case credsNone: - opts = append(opts, grpc.WithInsecure()) + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) default: logger.Fatal("Invalid creds") } diff --git a/interop/http2/negative_http2_client.go b/interop/http2/negative_http2_client.go index 9ed34f75716d..9fddc5f328a9 100644 --- a/interop/http2/negative_http2_client.go +++ b/interop/http2/negative_http2_client.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/interop" "google.golang.org/grpc/status" @@ -131,7 +132,7 @@ func main() { flag.Parse() serverAddr := net.JoinHostPort(*serverHost, strconv.Itoa(*serverPort)) var opts []grpc.DialOption - opts = append(opts, grpc.WithInsecure()) + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) conn, err := grpc.Dial(serverAddr, opts...) if err != nil { logger.Fatalf("Fail to dial: %v", err) diff --git a/profiling/cmd/remote.go b/profiling/cmd/remote.go index b6adfd6a6bef..71c21c332b74 100644 --- a/profiling/cmd/remote.go +++ b/profiling/cmd/remote.go @@ -26,6 +26,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" ppb "google.golang.org/grpc/profiling/proto" ) @@ -78,7 +79,7 @@ func remoteCommand() error { } logger.Infof("dialing %s", *flagAddress) - cc, err := grpc.Dial(*flagAddress, grpc.WithInsecure()) + cc, err := grpc.Dial(*flagAddress, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { logger.Errorf("cannot dial %s: %v", *flagAddress, err) return err diff --git a/reflection/serverreflection_test.go b/reflection/serverreflection_test.go index 24070141c2f2..9d23e2876423 100644 --- a/reflection/serverreflection_test.go +++ b/reflection/serverreflection_test.go @@ -30,6 +30,7 @@ import ( "github.com/golang/protobuf/proto" dpb "github.com/golang/protobuf/protoc-gen-go/descriptor" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/grpctest" rpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha" pb "google.golang.org/grpc/reflection/grpc_testing" @@ -205,7 +206,7 @@ func (x) TestReflectionEnd2end(t *testing.T) { go s.Serve(lis) // Create client. - conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("cannot connect to server: %v", err) } diff --git a/stats/stats_test.go b/stats/stats_test.go index 234919e86c8d..1b08568b906b 100644 --- a/stats/stats_test.go +++ b/stats/stats_test.go @@ -30,6 +30,7 @@ import ( "github.com/golang/protobuf/proto" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/grpctest" "google.golang.org/grpc/metadata" "google.golang.org/grpc/stats" @@ -246,7 +247,7 @@ func (te *test) clientConn() *grpc.ClientConn { return te.cc } opts := []grpc.DialOption{ - grpc.WithInsecure(), + grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithBlock(), grpc.WithUserAgent("test/0.0.1"), } diff --git a/stress/client/main.go b/stress/client/main.go index 37e2a38f42a2..5e260b172e8c 100644 --- a/stress/client/main.go +++ b/stress/client/main.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/grpclog" "google.golang.org/grpc/interop" "google.golang.org/grpc/status" @@ -293,7 +294,7 @@ func newConn(address string, useTLS, testCA bool, tlsServerName string) (*grpc.C } opts = append(opts, grpc.WithTransportCredentials(creds)) } else { - opts = append(opts, grpc.WithInsecure()) + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) } return grpc.Dial(address, opts...) } diff --git a/stress/metrics_client/main.go b/stress/metrics_client/main.go index ad6db6dd7a19..f64a64c8a3f0 100644 --- a/stress/metrics_client/main.go +++ b/stress/metrics_client/main.go @@ -26,6 +26,7 @@ import ( "io" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/grpclog" metricspb "google.golang.org/grpc/stress/grpc_testing" ) @@ -74,7 +75,7 @@ func main() { logger.Fatalf("Metrics server address is empty.") } - conn, err := grpc.Dial(*metricsServerAddress, grpc.WithInsecure()) + conn, err := grpc.Dial(*metricsServerAddress, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { logger.Fatalf("cannot connect to metrics server: %v", err) } diff --git a/test/authority_test.go b/test/authority_test.go index 0f823bdbd1b0..452b896eebf9 100644 --- a/test/authority_test.go +++ b/test/authority_test.go @@ -33,6 +33,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/stubserver" "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" @@ -193,7 +194,7 @@ func (s) TestColonPortAuthority(t *testing.T) { // // Append "localhost" before calling net.Dial, in case net.Dial on certain // platforms doesn't work well for address without the IP. - cc, err := grpc.Dial(":"+port, grpc.WithInsecure(), grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) { + cc, err := grpc.Dial(":"+port, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(func(ctx context.Context, addr string) (net.Conn, error) { return (&net.Dialer{}).DialContext(ctx, "tcp", "localhost"+addr) })) if err != nil { diff --git a/test/balancer_test.go b/test/balancer_test.go index 5d5c85896d30..8fe1db32658b 100644 --- a/test/balancer_test.go +++ b/test/balancer_test.go @@ -393,7 +393,7 @@ func (s) TestNonGRPCLBBalancerGetsNoGRPCLBAddress(t *testing.T) { b := newTestBalancerKeepAddresses() balancer.Register(b) - cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithResolvers(r), + cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r), grpc.WithBalancerName(b.Name())) if err != nil { t.Fatalf("failed to dial: %v", err) @@ -655,7 +655,7 @@ func (s) TestServersSwap(t *testing.T) { // Initialize client r := manual.NewBuilderWithScheme("whatever") r.InitialState(resolver.State{Addresses: []resolver.Address{{Addr: addr1}}}) - cc, err := grpc.DialContext(ctx, r.Scheme()+":///", grpc.WithInsecure(), grpc.WithResolvers(r)) + cc, err := grpc.DialContext(ctx, r.Scheme()+":///", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r)) if err != nil { t.Fatalf("Error creating client: %v", err) } @@ -709,7 +709,7 @@ func (s) TestEmptyAddrs(t *testing.T) { pfr.InitialState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String()}}}) - pfcc, err := grpc.DialContext(ctx, pfr.Scheme()+":///", grpc.WithInsecure(), grpc.WithResolvers(pfr)) + pfcc, err := grpc.DialContext(ctx, pfr.Scheme()+":///", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(pfr)) if err != nil { t.Fatalf("Error creating client: %v", err) } @@ -729,7 +729,7 @@ func (s) TestEmptyAddrs(t *testing.T) { rrr.InitialState(resolver.State{Addresses: []resolver.Address{{Addr: lis.Addr().String()}}}) - rrcc, err := grpc.DialContext(ctx, rrr.Scheme()+":///", grpc.WithInsecure(), grpc.WithResolvers(rrr), + rrcc, err := grpc.DialContext(ctx, rrr.Scheme()+":///", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(rrr), grpc.WithDefaultServiceConfig(fmt.Sprintf(`{ "loadBalancingConfig": [{"%v": {}}] }`, roundrobin.Name))) if err != nil { t.Fatalf("Error creating client: %v", err) @@ -785,7 +785,7 @@ func (s) TestWaitForReady(t *testing.T) { // Initialize client r := manual.NewBuilderWithScheme("whatever") - cc, err := grpc.DialContext(ctx, r.Scheme()+":///", grpc.WithInsecure(), grpc.WithResolvers(r)) + cc, err := grpc.DialContext(ctx, r.Scheme()+":///", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r)) if err != nil { t.Fatalf("Error creating client: %v", err) } diff --git a/test/end2end_test.go b/test/end2end_test.go index 957d13f731f7..cdf0434a1217 100644 --- a/test/end2end_test.go +++ b/test/end2end_test.go @@ -50,6 +50,7 @@ import ( "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/encoding" _ "google.golang.org/grpc/encoding/gzip" "google.golang.org/grpc/health" @@ -801,7 +802,7 @@ func (te *test) configDial(opts ...grpc.DialOption) ([]grpc.DialOption, string) case "empty": // Don't add any transport creds option. default: - opts = append(opts, grpc.WithInsecure()) + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials())) } // TODO(bar) switch balancer case "pick_first". var scheme string @@ -3740,7 +3741,7 @@ func (s) TestTransparentRetry(t *testing.T) { }, } server.start(t, lis) - cc, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + cc, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("failed to dial due to err: %v", err) } @@ -5131,7 +5132,7 @@ func (s) TestFlowControlLogicalRace(t *testing.T) { go s.Serve(lis) - cc, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + cc, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("grpc.Dial(%q) = %v", lis.Addr().String(), err) } @@ -6561,7 +6562,7 @@ func (s) TestServeExitsWhenListenerClosed(t *testing.T) { close(done) }() - cc, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + cc, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("Failed to dial server: %v", err) } @@ -6780,7 +6781,7 @@ func (s) TestDisabledIOBuffers(t *testing.T) { defer s.Stop() dctx, dcancel := context.WithTimeout(context.Background(), 5*time.Second) defer dcancel() - cc, err := grpc.DialContext(dctx, lis.Addr().String(), grpc.WithInsecure(), grpc.WithWriteBufferSize(0), grpc.WithReadBufferSize(0)) + cc, err := grpc.DialContext(dctx, lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithWriteBufferSize(0), grpc.WithReadBufferSize(0)) if err != nil { t.Fatalf("Failed to dial server") } @@ -6982,7 +6983,7 @@ func (s) TestNetPipeConn(t *testing.T) { go s.Serve(pl) ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() - cc, err := grpc.DialContext(ctx, "", grpc.WithInsecure(), grpc.WithDialer(pl.Dialer())) + cc, err := grpc.DialContext(ctx, "", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDialer(pl.Dialer())) if err != nil { t.Fatalf("Error creating client: %v", err) } @@ -7082,7 +7083,7 @@ func (s) TestGoAwayThenClose(t *testing.T) { {Addr: lis1.Addr().String()}, {Addr: lis2.Addr().String()}, }}) - cc, err := grpc.DialContext(ctx, r.Scheme()+":///", grpc.WithResolvers(r), grpc.WithInsecure()) + cc, err := grpc.DialContext(ctx, r.Scheme()+":///", grpc.WithResolvers(r), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("Error creating client: %v", err) } @@ -7483,7 +7484,7 @@ func doHTTPHeaderTest(t *testing.T, errCode codes.Code, headerFields ...[]string responses: []httpServerResponse{{trailers: headerFields}}, } server.start(t, lis) - cc, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + cc, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("failed to dial due to err: %v", err) } diff --git a/test/goaway_test.go b/test/goaway_test.go index 6ef11e26419d..1b5a3b7a04e7 100644 --- a/test/goaway_test.go +++ b/test/goaway_test.go @@ -25,6 +25,7 @@ import ( "time" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/stubserver" "google.golang.org/grpc/keepalive" testpb "google.golang.org/grpc/test/grpc_testing" @@ -57,7 +58,7 @@ func (s) TestGracefulClientOnGoAway(t *testing.T) { } go s.Serve(lis) - cc, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + cc, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("Failed to dial server: %v", err) } diff --git a/test/gracefulstop_test.go b/test/gracefulstop_test.go index 6058fb8b333c..a5a8448ad2fd 100644 --- a/test/gracefulstop_test.go +++ b/test/gracefulstop_test.go @@ -28,6 +28,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/stubserver" "google.golang.org/grpc/status" testpb "google.golang.org/grpc/test/grpc_testing" @@ -146,7 +147,7 @@ func (s) TestGracefulStop(t *testing.T) { // even though GracefulStop has closed the listener. ctx, dialCancel := context.WithTimeout(context.Background(), 5*time.Second) defer dialCancel() - cc, err := grpc.DialContext(ctx, "", grpc.WithInsecure(), grpc.WithContextDialer(d)) + cc, err := grpc.DialContext(ctx, "", grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithContextDialer(d)) if err != nil { t.Fatalf("grpc.DialContext(_, %q, _) = %v", lis.Addr().String(), err) } diff --git a/test/healthcheck_test.go b/test/healthcheck_test.go index 99f7d8951ebd..247ffea7c3c1 100644 --- a/test/healthcheck_test.go +++ b/test/healthcheck_test.go @@ -30,6 +30,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/connectivity" + "google.golang.org/grpc/credentials/insecure" _ "google.golang.org/grpc/health" healthgrpc "google.golang.org/grpc/health/grpc_health_v1" healthpb "google.golang.org/grpc/health/grpc_health_v1" @@ -154,7 +155,7 @@ type clientConfig struct { func setupClient(c *clientConfig) (cc *grpc.ClientConn, r *manual.Resolver, deferFunc func(), err error) { r = manual.NewBuilderWithScheme("whatever") var opts []grpc.DialOption - opts = append(opts, grpc.WithInsecure(), grpc.WithResolvers(r), grpc.WithBalancerName(c.balancerName)) + opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(r), grpc.WithBalancerName(c.balancerName)) if c.testHealthCheckFuncWrapper != nil { opts = append(opts, internal.WithHealthCheckFunc.(func(internal.HealthChecker) grpc.DialOption)(c.testHealthCheckFuncWrapper)) } diff --git a/test/insecure_creds_test.go b/test/insecure_creds_test.go index 9c925e4757c7..ec1bb41433cf 100644 --- a/test/insecure_creds_test.go +++ b/test/insecure_creds_test.go @@ -124,7 +124,7 @@ func (s) TestInsecureCreds(t *testing.T) { go s.Serve(lis) addr := lis.Addr().String() - opts := []grpc.DialOption{grpc.WithInsecure()} + opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} if test.clientInsecureCreds { opts = []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} } diff --git a/test/local_creds_test.go b/test/local_creds_test.go index 3933bb39635b..8d649ed5365f 100644 --- a/test/local_creds_test.go +++ b/test/local_creds_test.go @@ -29,6 +29,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/credentials" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/local" "google.golang.org/grpc/internal/stubserver" "google.golang.org/grpc/peer" @@ -218,7 +219,7 @@ func (s) TestLocalCredsClientFail(t *testing.T) { func (s) TestLocalCredsServerFail(t *testing.T) { // Use insecure at client-side which should lead to server-side failure. - opts := []grpc.DialOption{grpc.WithInsecure()} + opts := []grpc.DialOption{grpc.WithTransportCredentials(insecure.NewCredentials())} if err := testLocalCredsE2EFail(opts); status.Code(err) != codes.Unavailable { t.Fatalf("testLocalCredsE2EFail() = %v; want %v", err, codes.Unavailable) } diff --git a/test/retry_test.go b/test/retry_test.go index 1bd866add606..1013e54ce051 100644 --- a/test/retry_test.go +++ b/test/retry_test.go @@ -33,6 +33,7 @@ import ( "github.com/golang/protobuf/proto" "google.golang.org/grpc" "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/stubserver" "google.golang.org/grpc/metadata" "google.golang.org/grpc/stats" @@ -531,7 +532,7 @@ func (s) TestRetryStats(t *testing.T) { } server.start(t, lis) handler := &retryStatsHandler{} - cc, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure(), grpc.WithStatsHandler(handler), + cc, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithStatsHandler(handler), grpc.WithDefaultServiceConfig((`{ "methodConfig": [{ "name": [{"service": "grpc.testing.TestService"}], diff --git a/xds/csds/csds_test.go b/xds/csds/csds_test.go index fd19599ab094..1d772b67f376 100644 --- a/xds/csds/csds_test.go +++ b/xds/csds/csds_test.go @@ -30,6 +30,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/google/uuid" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/grpctest" "google.golang.org/grpc/internal/testutils" "google.golang.org/grpc/internal/xds" @@ -278,7 +279,7 @@ func commonSetup(ctx context.Context, t *testing.T) (xdsclient.XDSClient, *e2e.M }() // Create CSDS client. - conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("cannot connect to server: %v", err) } @@ -525,7 +526,7 @@ func (s) TestCSDSNoXDSClient(t *testing.T) { defer server.Stop() // Create CSDS client. - conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure()) + conn, err := grpc.Dial(lis.Addr().String(), grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { t.Fatalf("cannot connect to server: %v", err) } diff --git a/xds/internal/test/e2e/e2e.go b/xds/internal/test/e2e/e2e.go index 3c388fbf0d93..30b125b787a1 100644 --- a/xds/internal/test/e2e/e2e.go +++ b/xds/internal/test/e2e/e2e.go @@ -28,6 +28,7 @@ import ( "google.golang.org/grpc" channelzgrpc "google.golang.org/grpc/channelz/grpc_channelz_v1" channelzpb "google.golang.org/grpc/channelz/grpc_channelz_v1" + "google.golang.org/grpc/credentials/insecure" testgrpc "google.golang.org/grpc/interop/grpc_testing" testpb "google.golang.org/grpc/interop/grpc_testing" ) @@ -70,7 +71,7 @@ func newClient(target, binaryPath, bootstrap string, logger io.Writer, flags ... ) cmd.Start() - cc, err := grpc.Dial(fmt.Sprintf("localhost:%d", clientStatsPort), grpc.WithInsecure(), grpc.WithDefaultCallOptions(grpc.WaitForReady(true))) + cc, err := grpc.Dial(fmt.Sprintf("localhost:%d", clientStatsPort), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultCallOptions(grpc.WaitForReady(true))) if err != nil { return nil, err } diff --git a/xds/internal/test/xds_server_integration_test.go b/xds/internal/test/xds_server_integration_test.go index c2afebfd2253..6904e0e88d5c 100644 --- a/xds/internal/test/xds_server_integration_test.go +++ b/xds/internal/test/xds_server_integration_test.go @@ -565,7 +565,7 @@ func (s) TestServerSideXDS_RouteConfiguration(t *testing.T) { t.Fatal(err) } - cc, err := grpc.DialContext(ctx, fmt.Sprintf("xds:///%s", serviceName), grpc.WithInsecure(), grpc.WithResolvers(resolver)) + cc, err := grpc.DialContext(ctx, fmt.Sprintf("xds:///%s", serviceName), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(resolver)) if err != nil { t.Fatalf("failed to dial local test server: %v", err) } @@ -952,7 +952,7 @@ func (s) TestRBACHTTPFilter(t *testing.T) { t.Fatal(err) } - cc, err := grpc.DialContext(ctx, fmt.Sprintf("xds:///%s", serviceName), grpc.WithInsecure(), grpc.WithResolvers(resolver)) + cc, err := grpc.DialContext(ctx, fmt.Sprintf("xds:///%s", serviceName), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(resolver)) if err != nil { t.Fatalf("failed to dial local test server: %v", err) } @@ -1143,7 +1143,7 @@ func (s) TestRBACToggledOn_WithBadRouteConfiguration(t *testing.T) { t.Fatal(err) } - cc, err := grpc.DialContext(ctx, fmt.Sprintf("xds:///%s", serviceName), grpc.WithInsecure(), grpc.WithResolvers(resolver)) + cc, err := grpc.DialContext(ctx, fmt.Sprintf("xds:///%s", serviceName), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(resolver)) if err != nil { t.Fatalf("failed to dial local test server: %v", err) } @@ -1200,7 +1200,7 @@ func (s) TestRBACToggledOff_WithBadRouteConfiguration(t *testing.T) { t.Fatal(err) } - cc, err := grpc.DialContext(ctx, fmt.Sprintf("xds:///%s", serviceName), grpc.WithInsecure(), grpc.WithResolvers(resolver)) + cc, err := grpc.DialContext(ctx, fmt.Sprintf("xds:///%s", serviceName), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithResolvers(resolver)) if err != nil { t.Fatalf("failed to dial local test server: %v", err) } diff --git a/xds/internal/xdsclient/controller/controller_test.go b/xds/internal/xdsclient/controller/controller_test.go index 8c7c2838d838..644698cc26f7 100644 --- a/xds/internal/xdsclient/controller/controller_test.go +++ b/xds/internal/xdsclient/controller/controller_test.go @@ -87,7 +87,7 @@ func (s) TestNew(t *testing.T) { name: "happy-case", config: &bootstrap.ServerConfig{ ServerURI: testXDSServer, - Creds: grpc.WithInsecure(), + Creds: grpc.WithTransportCredentials(insecure.NewCredentials()), NodeProto: testutils.EmptyNodeProtoV2, }, }, @@ -111,7 +111,7 @@ func (s) TestNew(t *testing.T) { func (s) TestNewWithGRPCDial(t *testing.T) { config := &bootstrap.ServerConfig{ ServerURI: testXDSServer, - Creds: grpc.WithInsecure(), + Creds: grpc.WithTransportCredentials(insecure.NewCredentials()), NodeProto: testutils.EmptyNodeProtoV2, } diff --git a/xds/internal/xdsclient/singleton_test.go b/xds/internal/xdsclient/singleton_test.go index 1bf6077f3952..b22663f33ab5 100644 --- a/xds/internal/xdsclient/singleton_test.go +++ b/xds/internal/xdsclient/singleton_test.go @@ -23,6 +23,7 @@ import ( "testing" "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/internal/testutils" xdstestutils "google.golang.org/grpc/xds/internal/testutils" "google.golang.org/grpc/xds/internal/xdsclient/bootstrap" @@ -37,7 +38,7 @@ func (s) TestClientNewSingleton(t *testing.T) { return &bootstrap.Config{ XDSServer: &bootstrap.ServerConfig{ ServerURI: testXDSServer, - Creds: grpc.WithInsecure(), + Creds: grpc.WithTransportCredentials(insecure.NewCredentials()), NodeProto: xdstestutils.EmptyNodeProtoV2, }, }, nil