Documentation ¶
Overview ¶
Package protofiles is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterYourServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterYourServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client YourServiceClient) error
- func RegisterYourServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterYourServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server YourServiceServer) error
- func RegisterYourServiceServer(s *grpc.Server, srv YourServiceServer)
- type StringMessage
- type UnimplementedYourServiceServer
- type UnsafeYourServiceServer
- type YourServiceClient
- type YourServiceServer
Constants ¶
This section is empty.
Variables ¶
var File_echo_proto protoreflect.FileDescriptor
Functions ¶
func RegisterYourServiceHandler ¶
func RegisterYourServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterYourServiceHandler registers the http handlers for service YourService to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterYourServiceHandlerClient ¶
func RegisterYourServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client YourServiceClient) error
RegisterYourServiceHandlerClient registers the http handlers for service YourService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "YourServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "YourServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "YourServiceClient" to call the correct interceptors.
func RegisterYourServiceHandlerFromEndpoint ¶
func RegisterYourServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterYourServiceHandlerFromEndpoint is same as RegisterYourServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterYourServiceHandlerServer ¶
func RegisterYourServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server YourServiceServer) error
RegisterYourServiceHandlerServer registers the http handlers for service YourService to "mux". UnaryRPC :call YourServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterYourServiceHandlerFromEndpoint instead.
func RegisterYourServiceServer ¶
func RegisterYourServiceServer(s *grpc.Server, srv YourServiceServer)
Types ¶
type StringMessage ¶
type StringMessage struct { Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` // contains filtered or unexported fields }
func (*StringMessage) Descriptor
deprecated
func (*StringMessage) Descriptor() ([]byte, []int)
Deprecated: Use StringMessage.ProtoReflect.Descriptor instead.
func (*StringMessage) GetValue ¶
func (x *StringMessage) GetValue() string
func (*StringMessage) ProtoMessage ¶
func (*StringMessage) ProtoMessage()
func (*StringMessage) ProtoReflect ¶
func (x *StringMessage) ProtoReflect() protoreflect.Message
func (*StringMessage) Reset ¶
func (x *StringMessage) Reset()
func (*StringMessage) String ¶
func (x *StringMessage) String() string
type UnimplementedYourServiceServer ¶
type UnimplementedYourServiceServer struct { }
UnimplementedYourServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedYourServiceServer) Echo ¶
func (UnimplementedYourServiceServer) Echo(context.Context, *StringMessage) (*StringMessage, error)
type UnsafeYourServiceServer ¶
type UnsafeYourServiceServer interface {
// contains filtered or unexported methods
}
UnsafeYourServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to YourServiceServer will result in compilation errors.
type YourServiceClient ¶
type YourServiceClient interface {
Echo(ctx context.Context, in *StringMessage, opts ...grpc.CallOption) (*StringMessage, error)
}
YourServiceClient is the client API for YourService service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewYourServiceClient ¶
func NewYourServiceClient(cc grpc.ClientConnInterface) YourServiceClient
type YourServiceServer ¶
type YourServiceServer interface { Echo(context.Context, *StringMessage) (*StringMessage, error) // contains filtered or unexported methods }
YourServiceServer is the server API for YourService service. All implementations must embed UnimplementedYourServiceServer for forward compatibility