59 Commits

Author SHA1 Message Date
cuoguojida
f30a5a5545 refactor: remove obsolete // +build tag (#560)
Signed-off-by: cuoguojida <cuoguojida@outlook.com>
2026-05-19 07:47:53 -04:00
rifeplight
1ad1dc15dd refactor: use strings.Builder to improve performance (#537)
Signed-off-by: rifeplight <rifeplight@outlook.com>
2025-10-29 08:07:46 -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
d00c28104b avoid overflow in various timeouts (#505) 2025-02-19 11:36:35 -05: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
Hector Oliveros
46c38b351a feat: Add functionality to export proto files (#475)
* Add functionality to export proto files

Added a new function, `WriteProtoFiles` in `desc_source.go` which is used to generate .proto files. The process involves resolving symbols from the descriptor source and writing their definitions to a designated output directory. The corresponding flag `--proto-out` has been included in `grpcurl.go` to allow users to specify the directory path.

* Refactor file creation error handling

The code for file creation and error handling in desc_source.go has been refactored. Previously, the file closure operation was executed irrespective of whether the file was created successfully or not. Now, the file will only be closed if it was successfully created, improving error handling.

* Update 'proto-out' command to 'proto-out-dir'

The command for exporting proto files and setting the output directory has been updated from 'proto-out' to 'proto-out-dir'. This change has been made both in the README and the grpcurl go file. This makes the command name more descriptive, accurately reflecting its functionality.

* fix import sort

* Reorder file close operation in error handling

The file close operation has been moved within the error handling of the 'PrintProtoFile' function. Previously, it was being executed before this function, now it's executed immediately after. Moreover, an additional close operation has been added after the function success ensuring the file is properly closed in all scenarios.

* Update grpcurl commands in README

The grpcurl commands for exporting proto files and protoset files in the README are updated. The IP address has been changed to localhost and port number to '8787'. Also, the service name is adjusted to 'my.custom.server.Service'. Instructions for use of specific command options are added for enhanced clarity.

* Refactor error handling in file creation

The code responsible for error handling during file creation in the desc_source.go file has been streamlined. This modification simplifies the code by reducing unnecessary condition checks and redundant file closure action after an error has occurred.

* Refactor proto file writing into separate function

The file writing process for protobuf files has been extracted into a new function called writeProtoFile(). This refactoring simplifies the main function. The code is cleaner and more manageable this way, improving maintainability and readability.

* Refactor writeProtoFile function for better error handling

Streamlined the writeProtoFile function in desc_source.go file. Simplified path calculations and improved error messages for file-creation functions, making it easier to trace the exact point of failure and enhance the debugging process.
2024-07-12 12:47:32 -04:00
goodfirm
0e13e85e65 chore: fix some typos in comments (#454)
Signed-off-by: goodfirm <fanyishang@yeah.net>
2024-04-10 09:51:09 -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
Kristopher Wuollett
149a93e0ec Use localhost for default unix domain socket authority (#445) 2024-01-30 11:38:15 -05:00
KaibutsuX
24b80dfed8 Added initial support for -t flag to show timings (#428)
* Added initial support for -t flag to show timings

Shows very basic timing data for the Dial stage (TLS setup and
BlockingDial) and InvokeRPC method as well as the total time.

* Made timing data part of the very verbose functionality

* cleanup

* fix

---------

Co-authored-by: Scott Blum <dragonsinth@gmail.com>
2024-01-23 19:04:51 -05:00
Michael Diamond
334e3f56de Expand the documentation of -max-time to clarify this sets the RPC timeout (#435)
Notably, this adds the words "timeout" and "deadline" to this help text which is helpful for discovering this flag.
2024-01-09 11:39:10 -05:00
Scott Blum
7ccaf0a21f indent: rip out old go 1.9 support 2023-11-22 08:54:31 -05:00
Jonathan Beaulieu
c17f0782f7 Added alts credential option (#341)
* Added alts credential option

Added flag that sets up ALTS credentials to connect to gRPC services using Application Layer Transport Security.

Reference: https://grpc.io/docs/languages/go/alts/
Fixes: #333

* Added ALTS client options as cmd arguments.

* Update target service accounts docs

Co-authored-by: Joshua Humphries <2035234+jhump@users.noreply.github.com>

* Applied feedback

* Small fix: removed indirection on usetls

---------

Co-authored-by: Joshua Humphries <2035234+jhump@users.noreply.github.com>
2023-09-25 13:57:49 -04:00
Valters Jansons
2a29c1e64b Use grpc.reflection.v1.ServerReflection (#407)
The proper `v1` gRPC reflection has been around for a bit.
The "client auto" mechanism still supports falling back to `v1alpha`.
Not many support the `v1`, but we should default to it when possible.
2023-08-31 12:13:33 -04: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
cui fliter
fec466efa6 fix some typos (#314)
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-07-20 14:57:53 -04:00
Lyubomir Gardev
353e0953cb Enable support for Unix sockets for Windows by enabling -unix flag for Windows builds. (#317) 2022-06-20 09:37:33 -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
Jeffrey Duce
9ac7e3a34d set value of creds instead of creating new variable (#263) 2021-10-07 15:49:59 -04:00
Igor
127194b205 Support SSLKEYLOGFILE environment variable for key logging (#245) 2021-09-20 11:53:44 -04:00
Joshua Humphries
8d7770a962 use latest version of protoreflect (#212) 2021-02-22 17:32:40 -05:00
Leonhard Markert
1f34448998 Help text for "-H" option: remove duplicated word (#207) 2021-02-01 10:31:49 -05:00
Mikhail Katychev
9da71fbe53 when -format-error option is used, format service reflection errors, too (#188) 2020-09-30 13:24:46 -04:00
Guilherme Salazar
9846afccbc feat: add support for user-agent header (#182) 2020-09-04 11:31:28 -04:00
Sergei Vorobev
e544b9e66f Print size of the message in very verbose mode (#181)
Adds -vv flag for "very verbose".
Includes estimated message size when enabled. The size is an estimate because it is the canonical size for the proto message, but not necessarily its actual on-the-wire size.
2020-08-14 11:02:42 -04:00
Adam Babik
8e51c5e2d3 cmd/grpcurl: add -allow-unknown-fields option (#147) 2020-07-23 10:54:06 -04: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
Mikhail Katychev
36008aa111 Add -format-error option (#155) 2020-05-14 20:40:13 -04:00
Alexander Chiu
36f9e53dfd Allow extra descriptor sources in reflection mode (#146)
Allows descriptors or proto files to be supplied that are used as an additional descriptor source when server reflection is used. This is needed to resolve message types embedded in an Any message, that the server has no knowledge of, as well as extensions that the server has no knowledge of.
2020-04-20 15:42:11 -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
Blake Williams
9572bd4525 Register gzip decoder (#124) 2019-11-26 08:55:50 -05:00
Joshua Humphries
ccc9007156 add -protoset-out option (#120) 2019-09-30 09:50:17 -04:00
J M
9248ea0963 Add Expand Headers Feature (#117) 2019-09-26 17:26:38 -04:00
Joshua Humphries
5631bba117 add official Dockerfile (#104) 2019-07-03 15:57:24 -04:00
Joshua Humphries
5d6316f470 Adds support for showing error details (#98)
To better support printing of google.protobuf.Any messages (error details), this
also makes a few other changes:
1. Allows printing of unresolvable Any messages using an "@value" field in JSON output
   that has the base64-encoded embedded message data.
2. Improves support for "-format text" to show expanded Any messages if possible.
   (Due to limitations in underlying proto package, this will usually *not* be
   that helpful. But this should greatly improve with v2 of the go protobuf API.)
3. Addresses a TODO in existing AnyResolver code to lazily fetch descriptors
   as needed instead of having to download all files eagerly.
2019-04-09 09:34:39 -04:00
Joshua Humphries
4c9c82cec3 use custom flagset (#85) 2019-02-28 10:58:53 -05:00
Joshua Humphries
5082a1dc68 add -max-msg-sz flag (#84) 2019-02-28 08:35:50 -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
a337c1afcf improve flag doc with go 1.10+ (#56) 2018-10-18 13:16:33 -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
Leigh McCulloch
79a550b858 add goreleaser (#49)
* add goreleaser

Add a goreleaser configuration file that builds binaries for Linux,
MacOS and Windows, for 32bit (x86/386) and 64bit (x64/amd64). The
binaries will be archived into a tar.gz/zip file along with the LICENSE
file.

The `dist/` directory will be written to by goreleaser with the binaries
during the build process, so it's also been added to .gitignore.

To build all the binaries and release them to GitHub:
1. Tag the release. e.g. `git tag -a v1.0.0 -m 'First release'`
2. Generate a GitHub Personal Access Token. See https://github.com/settings/tokens.
3. Push the release to GitHub. e.g. `git push origin v1.0.0`
4. Make the release, which will publish binaries to the GitHub "Releases" page. e.g.  `GITHUB_TOKEN=xxxxxxx... make release`

* add -version flag

Run `grpcurl -version` to see the release version. Use `make install` to build a binary that shows the version based on current git hash (which will show a version number if HEAD is a release tag and otherwise uses `git describe` to summarize the version).
2018-09-25 09:34:02 -04:00
Joshua Humphries
6198551381 add bankdemo, from Gophercon 2018 demo (#45) 2018-09-07 18:21:02 -04:00
Jean de Klerk
b709105be9 allow period at the start of a symbol (#40) 2018-07-06 22:41:22 +02:00
KUOKA Yusuke
75dcbf0d4c Allow passing :authority pseudo header (#33) 2018-05-24 12:18:45 -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
Josh Humphries
e6ac789274 grpclog.Printf deprecated; use Info instead 2018-05-08 10:08:35 -04:00
Joshua Humphries
ca5693f42c support unix sockets (#26) 2018-03-27 11:24:35 -04:00