43 Commits

Author SHA1 Message Date
bcleenders 13ca681bad Add support for TLS 1.3
This PR allows TLS 1.3, by removing the MaxVersion in the client config.

This would silently swallow errors, so e.g. a client without cert
dialing a server that requires client certs would lead to an error which
gets ignored, leading to retries until timeout.

In this PR, we wrap the connection and if an error occurs we send it to
the existing `result` channel.

I think this matches @jhump's comment in https://github.com/fullstorydev/grpcurl/issues/387#issuecomment-1517098394

 **Testing**

```console
 # Start the test server (in another tab)
go run ./internal/testing/cmd/testserver \
    -cert internal/testing/tls/server.crt \
    -key internal/testing/tls/server.key \
    -cacert internal/testing/tls/ca.crt \
    -requirecert -p 9999

 # Old behavior
$ grpcurl -cacert internal/testing/tls/ca.crt \
    localhost:9999 list
Failed to dial target host "localhost:9999": context deadline exceeded

 # New behavior
$ go run ./cmd/grpcurl -cacert internal/testing/tls/ca.crt \
    localhost:9999 list
Failed to dial target host "localhost:9999": remote error: tls: certificate required
exit status 1
```

The old behavior is to hang until we hit the deadline. The new behavior
is to return immediately with an error.

Fixes #563
2026-06-06 15:36:00 +02:00
Oleg Bonar cb68aaa7f5 Bump google.golang.org/grpc from 1.66.2 to 1.80.0 (#556)
Migrate from deprecated grpc.DialContext/WithBlock to grpc.NewClient
with connectivity state polling in BlockingDial. Add passthrough:///
scheme prefix for bare addresses to preserve resolver behavior.
2026-06-05 11:02:39 -04:00
vastonus f575e91b2c refactor: use slices.Contains to simplify code (#536)
Signed-off-by: vastonus <vastonus@outlook.com>
2025-10-16 07:57:01 -04:00
zhyuri 614b1687cf Restore Unix socket support (#498)
https://github.com/fullstorydev/grpcurl/issues/496

Restore -unix to working properly by default with the default dialer.
2025-03-18 08:47:55 -04:00
Joshua Humphries 7e1a6c9068 Update to v1.17.0 of jhump/protoreflect (#502)
* update to v1.17.0 of jhump/protoreflect

* add lint:ignore annotations to fix CI
2025-01-13 10:33:18 -05:00
Nathan Mische cdb43b08fa Remove custom dialer in order to use the default grpc-go dialer, which supports proxies. (#480) 2024-10-03 11:43:25 -04:00
Violin 239dde4a62 feat: introduce transparent client side health check (#463) 2024-05-08 10:47:02 -04:00
Joshua Humphries 07361b21ea Use latest protoreflect to fix some bugs (#453)
* update to latest jhump/protoreflect

* be lenient when possible if server cannot furnish all dependencies

* move linting back to go 1.21 instead of latest go 1.22

* make staticcheck happy
2024-04-09 17:50:10 -04:00
Paul Chesnais 5592211a41 Enable xDS credentials (#424)
* Enable xDS credentials

This change should be relatively straightforward. It is a noop outside of the
context of xDS (as demonstrated by the fact that the tests all pass), but it
enables xDS-provided certificates (i.e. the ones that would be
provided/specified in GRPC_XDS_BOOTSTRAP). See proposal
[A29](https://github.com/grpc/proposal/blob/master/A29-xds-tls-security.md#go)
for additional detail.

* Only enable xds credentials if the target is an xDS target

* Update after merge
2024-02-12 13:49:16 -05:00
cui fliter 85f1cbf7ad fix funcname in comment (#346)
Signed-off-by: cui fliter <imcusg@gmail.com>

Signed-off-by: cui fliter <imcusg@gmail.com>
2022-11-09 07:59:56 -05:00
dependabot[bot] dd2f60135c Bump github.com/jhump/protoreflect from 1.13.0 to 1.14.0 (#343)
* Bump github.com/jhump/protoreflect from 1.13.0 to 1.14.0

Bumps [github.com/jhump/protoreflect](https://github.com/jhump/protoreflect) from 1.13.0 to 1.14.0.
- [Release notes](https://github.com/jhump/protoreflect/releases)
- [Commits](https://github.com/jhump/protoreflect/compare/v1.13.0...v1.14.0)

---
updated-dependencies:
- dependency-name: github.com/jhump/protoreflect
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix ci

* what can we even build on?

* stop testing old things

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Scott Blum <dragonsinth@gmail.com>
2022-11-01 10:26:55 -04:00
Jeff Widman b34b13bab3 Bump grpc lib and fix deprecations (#286)
* Bump google.golang.org/grpc from 1.37.0 to 1.44.0

Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.37.0 to 1.44.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](https://github.com/grpc/grpc-go/compare/v1.37.0...v1.44.0)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-02-05 10:28:05 -05:00
Igor 127194b205 Support SSLKEYLOGFILE environment variable for key logging (#245) 2021-09-20 11:53:44 -04:00
Joshua Humphries de25c89822 allow callers of BlockingDial to override grpc.FailOnNonTempDialError dial option (#241) 2021-07-12 15:27:33 -04:00
Joshua Humphries 8d7770a962 use latest version of protoreflect (#212) 2021-02-22 17:32:40 -05:00
Joshua Humphries 0162fa9726 go.mod and Makefile tweaks; move import of xds package to cmd/grpcurl (#170) 2020-07-14 12:20:32 -04:00
Erik Johansson b8c67b7a4e Bump grpc-go to 1.30.0 (#168)
* Bump grpc-go to 1.30.0
* Import new xds package instead of experimental

Co-authored-by: Erik Johansson <ejohansson@spotify.com>
2020-07-13 13:16:48 -04:00
Richard Belleville 96cfd48e32 Activate xDS support in grpcurl (#137) 2020-03-13 16:29:41 -04:00
Joshua Humphries 0d669e78d0 use wrapped TransportCredentials instead of handling handshake in Dialer (#130)
* use wrapped TransportCredentials instead of handling handshake in Dialer, so that grpc library will use correct :scheme
* support -authority for TLS conns; now effectively supercedes -servername flag
2020-01-27 12:15:47 -05:00
J M 9248ea0963 Add Expand Headers Feature (#117) 2019-09-26 17:26:38 -04:00
Joshua Humphries 5516a45602 update proto and grpc deps (#81)
Fixes the build by updating grpc (and deps) and using new, non-deprecated function
2019-02-27 17:30:44 -05:00
Joshua Humphries 9fa2fce63b make method invocation resilient to errors trying to load all files from server (#74) 2018-12-13 11:44:43 -05:00
Joshua Humphries d86529bb4f don't use TLS 1.3, which isn't quite right yet in Go tip (#66) 2018-11-15 20:27:01 -05:00
Joshua Humphries 1e8e50f4f8 make MakeTemplate more robust (#60) 2018-10-22 22:59:11 -04:00
Joshua Humphries 7cabe7a9d0 move more stuff from cmd to package (#59) 2018-10-19 14:47:25 -04:00
Joshua Humphries 9a4bbacdd6 some pre-factoring and small fixes (#58)
* organize into multiple files
* make listing methods show fully-qualified names
* address small feedback from recent change (trim then check if empty)
2018-10-18 23:51:38 -04:00
Joshua Humphries 58cd93280e use proto syntax for describe (#57) 2018-10-18 13:50:44 -04:00
Joshua Humphries e00ef3eb7c add option to support text format (#54)
* augments grpcurl package API in order to handle multiple formats
* deprecates old signature for InvokeRpc
* add command-line flag to use protobuf text format instead of JSON
* use AnyResolver when marshaling to/from JSON
2018-10-16 21:26:16 -04:00
Ryo Nakao 2dd771c49e fix typo in InvokeRpc() comment (#50) 2018-09-26 22:02:34 -04:00
Joshua Humphries 00643a3fb8 fix race condition in bidi tests (#35) 2018-05-29 11:04:40 -04:00
Joshua Humphries ec219b3c15 allow the use of proto source files directly, instead of having to compile to protoset files (#32) 2018-05-23 14:13:24 -04:00
Joshua Humphries ca5693f42c support unix sockets (#26) 2018-03-27 11:24:35 -04:00
Joshua Humphries 224c3acd1d enable more linters in CI; fix some issues caught by them (#23) 2018-03-24 10:33:21 -04:00
Peter Edge ceba64b971 Delete references to json.RawMessage (#12) 2018-02-20 15:03:05 -05:00
Joshua Humphries 620796528e fix nil dereference (#10) 2018-02-19 22:28:26 -05:00
Peter Edge cdea962127 Add DescriptorSourceFromFileDescriptorSet (#4) 2018-02-17 17:30:03 -05:00
Stephan Renatus 7d304729b4 make jsonpb marshaler emit defaults (#3)
add `-emit-defaults` flag so that output will include default values (e.g. "false" for boolean flags)
2018-02-05 10:52:29 -05:00
Josh Humphries 4f202d18f3 support binary headers; flesh out doc for some exported symbols that were previously undocumented 2017-12-13 16:01:48 -05:00
Josh Humphries 1eec3bcbd6 oops -- remove some unused code 2017-12-13 15:46:56 -05:00
Josh Humphries 91fb94b700 fix CI tests to work with go 1.6; add another error message that was observed in CI 2017-12-13 15:31:48 -05:00
Josh Humphries 6c05311fb9 use custom dialer so we can show better error messages when things like TLS handshakes go awry; restore error message checks in tls tests 2017-12-13 15:30:57 -05:00
Josh Humphries 45e17ae10b grpc connection management no longer yields same errors from dial; also fix fmt issue in error message 2017-12-05 01:53:17 -05:00
Josh Humphries 9dfaded6cf initial commit, functioning grpcurl command-line util 2017-11-20 13:15:15 -05:00