Skip to content

horstf/goshape

Repository files navigation

GoShape - gRPC Reflection CLI Tool

A command-line tool that uses gRPC reflection to help developers interact with gRPC services.

Features

  • Connect to any gRPC server with reflection enabled
  • List all available methods on a gRPC service
  • Generate JSON example request bodies for any gRPC method
  • Support for nested message types and complex structures
  • Secure and insecure connection options

Installation

# Install with go install
go install github.com/horstf/goshape@latest

# Or build from source
git clone https://github.com/horstf/goshape.git
cd goshape
make build

Usage

List all methods on a gRPC server

goshape --host localhost --port 50051 --list-methods

Generate a JSON request template for a specific method

goshape --host localhost --port 50051 --method MusicService.GetAlbum

Example output:

{
  "id": "00000000-0000-0000-0000-000000000000"
}

Additional options

# Use an insecure connection (default)
goshape --host localhost --port 50051 --method MusicService.GetAlbum --insecure

# Set a custom timeout (in seconds)
goshape --host localhost --port 50051 --method MusicService.GetAlbum --timeout 5

# Use secure connection with TLS
goshape --host localhost --port 50051 --method MusicService.GetAlbum --insecure=false --ca-cert=ca.pem

Development

Prerequisites

  • Go 1.24 or higher
  • Protocol Buffers compiler (protoc)
  • Go plugins for Protocol Buffers

Setup

  1. Clone the repository
  2. Install dependencies: go mod download
  3. Generate protobuf code: make proto
  4. Build the tool: make build

Testing

Run the included test server:

make run-test-server

In another terminal, test the tool against the server:

./goshape --host localhost --port 50051 --list-methods
./goshape --host localhost --port 50051 --method MusicService.GetAlbum

Run the test suite:

# Run unit tests
make test

# Run integration tests (requires the test server)
go test -tags=integration ./...

# Run all tests with coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors