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.
This commit is contained in:
Valters Jansons
2023-08-31 19:13:33 +03:00
committed by GitHub
parent 9a59bed1d2
commit 2a29c1e64b
3 changed files with 7 additions and 9 deletions

View File

@@ -21,7 +21,6 @@ import (
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/metadata"
reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
"google.golang.org/grpc/status"
"google.golang.org/protobuf/types/descriptorpb"
@@ -508,7 +507,7 @@ func main() {
md := grpcurl.MetadataFromHeaders(append(addlHeaders, reflHeaders...))
refCtx := metadata.NewOutgoingContext(ctx, md)
cc = dial()
refClient = grpcreflect.NewClientV1Alpha(refCtx, reflectpb.NewServerReflectionClient(cc))
refClient = grpcreflect.NewClientAuto(refCtx, cc)
reflSource := grpcurl.DescriptorSourceFromServer(ctx, refClient)
if fileSource != nil {
descSource = compositeSource{reflSource, fileSource}