Skip to content

Commit cdb43b0

Browse files
authored
Remove custom dialer in order to use the default grpc-go dialer, which supports proxies. (#480)
1 parent 56181ba commit cdb43b0

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

grpcurl.go

+1-16
Original file line numberDiff line numberDiff line change
@@ -645,21 +645,6 @@ func BlockingDial(ctx context.Context, network, address string, creds credential
645645
writeResult: writeResult,
646646
}
647647

648-
dialer := func(ctx context.Context, address string) (net.Conn, error) {
649-
// NB: We *could* handle the TLS handshake ourselves, in the custom
650-
// dialer (instead of customizing both the dialer and the credentials).
651-
// But that requires using insecure.NewCredentials() dial transport
652-
// option (so that the gRPC library doesn't *also* try to do a
653-
// handshake). And that would mean that the library would send the
654-
// wrong ":scheme" metaheader to servers: it would send "http" instead
655-
// of "https" because it is unaware that TLS is actually in use.
656-
conn, err := (&net.Dialer{}).DialContext(ctx, network, address)
657-
if err != nil {
658-
writeResult(err)
659-
}
660-
return conn, err
661-
}
662-
663648
// Even with grpc.FailOnNonTempDialError, this call will usually timeout in
664649
// the face of TLS handshake errors. So we can't rely on grpc.WithBlock() to
665650
// know when we're done. So we run it in a goroutine and then use result
@@ -670,7 +655,7 @@ func BlockingDial(ctx context.Context, network, address string, creds credential
670655
opts = append([]grpc.DialOption{grpc.FailOnNonTempDialError(true)}, opts...)
671656
// But we don't want caller to be able to override these two, so we put
672657
// them *after* the explicitly provided options.
673-
opts = append(opts, grpc.WithBlock(), grpc.WithContextDialer(dialer), grpc.WithTransportCredentials(creds))
658+
opts = append(opts, grpc.WithBlock(), grpc.WithTransportCredentials(creds))
674659

675660
conn, err := grpc.DialContext(ctx, address, opts...)
676661
var res interface{}

0 commit comments

Comments
 (0)