Skip to content

Commit e78754d

Browse files
authored
Replace grpc.WithInsecure() (#37)
1 parent b472647 commit e78754d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ The first two arguments are the same as for `grpc.DialContext`. The third argume
6363
config to be used for connecting to the target address. Note that this is different from the usual gRPC API,
6464
which specifies client TLS config via the `grpc.WithTransportCredentials`. For a plaintext (unencrypted)
6565
connection to the server, pass a `nil` TLS config; however, this does *not* free you from passing the
66-
`grpc.WithInsecure()` gRPC dial option.
66+
`grpc.WithInsecure()` (nor `grpc.WithTransportCredentials(insecure.NewCredentials())`) gRPC dial option.
6767

6868
The last (variadic) parameter specifies options that modify the dialing behavior. You can pass any gRPC dial
6969
options via `client.DialOpts(...)`; however, the `grpc.WithTransportCredentials` option will not be needed.

_integration-tests/echo_service_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"golang.stackrox.io/grpc-http1/server"
3434
"google.golang.org/grpc"
3535
"google.golang.org/grpc/codes"
36+
"google.golang.org/grpc/credentials/insecure"
3637
"google.golang.org/grpc/examples/features/proto/echo"
3738
"google.golang.org/grpc/metadata"
3839
"google.golang.org/grpc/status"
@@ -374,15 +375,15 @@ func (c *testCase) Run(t *testing.T, cfg *testConfig) {
374375
)
375376

376377
if c.useProxy {
377-
opts := []client.ConnectOption{client.DialOpts(grpc.WithInsecure())}
378+
opts := []client.ConnectOption{client.DialOpts(grpc.WithTransportCredentials(insecure.NewCredentials()))}
378379
if !c.behindHTTP1ReverseProxy {
379380
opts = append(opts, client.ForceHTTP2())
380381
}
381382
opts = append(opts, client.UseWebSocket(c.useWebSocket), client.ForceDowngrade(c.forceDowngrade))
382383

383384
cc, err = client.ConnectViaProxy(ctx, targetAddr, nil, opts...)
384385
} else {
385-
cc, err = grpc.DialContext(ctx, targetAddr, grpc.WithInsecure())
386+
cc, err = grpc.DialContext(ctx, targetAddr, grpc.WithTransportCredentials(insecure.NewCredentials()))
386387
}
387388
require.NoError(t, err, "failed to establish connection")
388389

0 commit comments

Comments
 (0)