Begonia is an HTTP to gRPC reverse proxy server, which registers services defined by `gRPC-gateway` to the gateway based on the descriptor_set_out generated by protoc, thereby implementing reverse proxy functionality. The HTTP service follows the RESTful standard to handle HTTP requests and forwards RESTful requests to gRPC services.
- Compatible with all
gRPC-gateway
functionality features. - All gRPC request methods and their parameter formats can be requested and forwarded through HTTP 1.1.
- Forwards gRPC bi-directional streaming service requests based on WebSockets.
- Forwards server-side streaming responses based on the SSE (Server-Side-Event) protocol.
- Forwards gRPC client streaming requests based on a custom
application/begonia-client-stream
request type. - Allows requests with
application/x-www-form-urlencoded
andmultipart/form-data
parameter formats. - Rich built-in middleware, such as APIKEY verification, AKSK verification, and
go-playground/validator
for parameter validation middleware.parameter verification middleware - Dynamic registration, updating, and deletion of gRPC service routes based on the protoc descriptor_set_out.
git clone https://github.com/begonia-org/begonia.git
cd begonia && make install
Refer to example/example.proto
protoc --descriptor_set_out=example.pb --include_imports --proto_path=./ example.proto
docker compose up -d
begonia init -e dev
begonia start -e dev
go run . endpoint add -n "example" -d /data/work/begonia-org/begonia/example/example.pb -p 127.0.0.1:1949 -p 127.0.0.1:2024
curl -vvv http://127.0.0.1:12138/api/v1/example/hello
Apache License2.0 © geebytes
Feel free to PR and raise issues.
Thanks to the following projects for providing inspiration and reference:
- gRPC-gateway - Begonia gateway's routing management references and incorporates some code from gRPC-gateway.
- Kratos - Begonia's gRPC traffic proxy and forwarding functionality reference and incorporate some code from the Kratos project.