connect-grpcreflect-go
connect-grpcreflect-go
adds support for gRPC's server reflection API to any
net/http
server — including those built with Connect. With
server reflection enabled, ad-hoc debugging tools can call your gRPC-compatible
handlers and print the responses without a copy of the schema.
The exposed reflection API is wire compatible with Google's gRPC
implementations, so it works with grpcurl, grpcui, BloomRPC, and many
other tools.
For more on Connect, see the announcement blog post, the documentation
on connect.build (especially the Getting Started guide for Go), the
connect-go
repo, or the demo service.
Example
package main
import (
"net/http"
"golang.org/x/net/http2"
"golang.org/x/net/http2/h2c"
grpcreflect "github.com/bufbuild/connect-grpcreflect-go"
)
func main() {
mux := http.NewServeMux()
reflector := grpcreflect.NewStaticReflector(
"acme.user.v1.UserService",
"acme.group.v1.GroupService",
)
mux.Handle(grpcreflect.NewHandlerV1(reflector))
mux.Handle(grpcreflect.NewHandlerV1Alpha(reflector))
http.ListenAndServe(
":8080",
h2c.NewHandler(mux, &http2.Server{}),
)
}
Status: Stable
This module is stable. It supports:
Within those parameters, connect-grpcreflect-go
follows semantic versioning.
We will not make breaking changes in the 1.x series of releases.
Legal
Offered under the Apache 2 license.