mirror of
https://github.com/gusaul/grpcox.git
synced 2025-01-24 05:04:39 +00:00
293bb364c0
Currently, grpcox depends on server reflection to get proto descriptor. It has a significant drawback, since not every grpc server support [server reflection](https://github.com/grpc/grpc/blob/master/doc/server-reflection.md#known-implementations). Using local proto files is more feasible, as every grpc server certainly have one. Even though using protofile should be simple enough, there's still a problem regarding this. Some protofile use extra plugins for their proto. i.e. gogoprotobuf is a project that does just that. The problems with plugins are most of them require explicit import to the plugin inside of the protofile. It will break grpcurl proto descriptor extraction. Thus, the plugin proto must be uploaded alongside the protofile. Also, the protofile should be modified automatically to change their import to local import. Given that, I proposed a way for the user to upload multiple protofile to grpcox. Then, use that to get the descriptor. Changelog: - Add `use local proto` checkbox in HTML client. On checked it will show upload button and list of selected proto. - `get-service` ajax will use POST when `use local proto` is checked. The uploaded protofile will be the payload for the ajax request. - Add a new route to handle POST "get-service". It will persist the uploaded protofile to `/tmp/` directory and add protos field in the resource. - Modify `openDescriptor` to use local proto if protos field in the resource is available. - Modify `openDescriptor` to return an error, as opening descriptor from local proto may fail. - Modify the main server so it can be shut down gracefully. This is necessary as grpcox need to remove persisted proto right after the server is turned off. This Pull Request will resolve #16 |
||
---|---|---|
core | ||
handler | ||
index | ||
.gitignore | ||
config.env | ||
docker-compose.yml | ||
Dockerfile | ||
go.mod | ||
go.sum | ||
grpcox.go | ||
LICENSE | ||
Makefile | ||
README.md |
gRPCox
turn gRPCurl into web based UI, extremely easy to use
Features
- Recognize and provide list of services and methods inside it as an options.
- Automatically recognize schema input and compose it into JSON based. (ensure your gRPC server supports server reflection). Examples for how to set up server reflection can be found here.
- Save established connection, and reuse it for next invoke/request (also can close/restart connection)
Installation
Docker
docker pull gusaul/grpcox:latest
then run
docker run -p 6969:6969 -v {ABSOLUTE_PATH_TO_LOG}/log:/log -d gusaul/grpcox
Docker Compose
from terminal, move to grpcox directory, then run command
docker-compose up
if you're using docker and want to connect gRPC on your local machine, then use
host.docker.internal:<your gRPC port>
instead of localhost
Golang
if you have golang installed on your local machine, just run command
make start
from grpcox directory
configure app preferences by editing config.env
file
var | usage | type | unit |
---|---|---|---|
MAX_LIFE_CONN | maximum idle time connection before closed | number | minute |
TICK_CLOSE_CONN | ticker interval to sweep expired connection | number | second |
set value 0 (zero)
to disable auto close idle connection.