How to use it ??
sh8 opened this issue · comments
Shun Iwase commented
I cannot figure out how to use this library with these codes.
director := func(ctx context.Context) (*grpc.ClientConn, error) {
if err := CheckBearerToken(ctx); err != nil {
return nil, grpc.Errorf(codes.PermissionDenied, "unauthorized access: %v", err)
}
stream, _ := transport.StreamFromContext(ctx)
backend, found := PreDialledBackends[stream.Method()];
if !found {
return nil, grpc.Errorf(codes.Unimplemented, "the service %v is not implemented", stream.Method)
}
return backend, nil
}
proxy := grpcproxy.NewProxy(director)
proxy.Server(boundListener)
Shun Iwase commented
I figured out how to use it.
Thanks.