Documentation ¶
Overview ¶
Package helloworld is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterHelloworldHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterHelloworldHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HelloworldClient) error
- func RegisterHelloworldHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterHelloworldHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HelloworldServer) error
- func RegisterHelloworldServer(s grpc.ServiceRegistrar, srv HelloworldServer)
- type HelloworldClient
- type HelloworldServer
- type PongResponse
- type UnimplementedHelloworldServer
- type UnsafeHelloworldServer
Constants ¶
This section is empty.
Variables ¶
var File_api_proto_v1_helloworld_proto protoreflect.FileDescriptor
var Helloworld_ServiceDesc = grpc.ServiceDesc{ ServiceName: "helloworld.Helloworld", HandlerType: (*HelloworldServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Ping", Handler: _Helloworld_Ping_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "api/proto/v1/helloworld.proto", }
Helloworld_ServiceDesc is the grpc.ServiceDesc for Helloworld service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterHelloworldHandler ¶
func RegisterHelloworldHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterHelloworldHandler registers the http handlers for service Helloworld to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterHelloworldHandlerClient ¶
func RegisterHelloworldHandlerClient(ctx context.Context, mux *runtime.ServeMux, client HelloworldClient) error
RegisterHelloworldHandlerClient registers the http handlers for service Helloworld to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "HelloworldClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "HelloworldClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "HelloworldClient" to call the correct interceptors.
func RegisterHelloworldHandlerFromEndpoint ¶
func RegisterHelloworldHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterHelloworldHandlerFromEndpoint is same as RegisterHelloworldHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterHelloworldHandlerServer ¶
func RegisterHelloworldHandlerServer(ctx context.Context, mux *runtime.ServeMux, server HelloworldServer) error
RegisterHelloworldHandlerServer registers the http handlers for service Helloworld to "mux". UnaryRPC :call HelloworldServer 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 RegisterHelloworldHandlerFromEndpoint instead.
func RegisterHelloworldServer ¶
func RegisterHelloworldServer(s grpc.ServiceRegistrar, srv HelloworldServer)
Types ¶
type HelloworldClient ¶
type HelloworldClient interface { // Sends a greeting Ping(ctx context.Context, in *emptypb.Empty, opts ...grpc.CallOption) (*PongResponse, error) }
HelloworldClient is the client API for Helloworld 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 NewHelloworldClient ¶
func NewHelloworldClient(cc grpc.ClientConnInterface) HelloworldClient
type HelloworldServer ¶
type HelloworldServer interface { // Sends a greeting Ping(context.Context, *emptypb.Empty) (*PongResponse, error) }
HelloworldServer is the server API for Helloworld service. All implementations should embed UnimplementedHelloworldServer for forward compatibility
func NewHelloWorldServer ¶
func NewHelloWorldServer() HelloworldServer
type PongResponse ¶
type PongResponse struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
The request message containing the user's name.
message PingRequest { string name = 1; }
The response message containing the greetings
func (*PongResponse) Descriptor
deprecated
func (*PongResponse) Descriptor() ([]byte, []int)
Deprecated: Use PongResponse.ProtoReflect.Descriptor instead.
func (*PongResponse) GetMessage ¶
func (x *PongResponse) GetMessage() string
func (*PongResponse) ProtoMessage ¶
func (*PongResponse) ProtoMessage()
func (*PongResponse) ProtoReflect ¶
func (x *PongResponse) ProtoReflect() protoreflect.Message
func (*PongResponse) Reset ¶
func (x *PongResponse) Reset()
func (*PongResponse) String ¶
func (x *PongResponse) String() string
type UnimplementedHelloworldServer ¶
type UnimplementedHelloworldServer struct { }
UnimplementedHelloworldServer should be embedded to have forward compatible implementations.
func (UnimplementedHelloworldServer) Ping ¶
func (UnimplementedHelloworldServer) Ping(context.Context, *emptypb.Empty) (*PongResponse, error)
type UnsafeHelloworldServer ¶
type UnsafeHelloworldServer interface {
// contains filtered or unexported methods
}
UnsafeHelloworldServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HelloworldServer will result in compilation errors.