Documentation ¶
Overview ¶
Package echo contains protoc-generated output and implements a test and demo echo services. It is intended as for transflect testing only.
Package echo is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterEchoHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterEchoHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoClient) error
- func RegisterEchoHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterEchoHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServer) error
- func RegisterEchoServer(s grpc.ServiceRegistrar, srv EchoServer)
- type EchoClient
- type EchoServer
- type Echo_HelloStreamClient
- type Echo_HelloStreamServer
- type HelloRequest
- type HelloResponse
- type Server
- type UnimplementedEchoServer
- type UnsafeEchoServer
Constants ¶
This section is empty.
Variables ¶
var Echo_ServiceDesc = grpc.ServiceDesc{ ServiceName: "echo.Echo", HandlerType: (*EchoServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Hello", Handler: _Echo_Hello_Handler, }, }, Streams: []grpc.StreamDesc{ { StreamName: "HelloStream", Handler: _Echo_HelloStream_Handler, ServerStreams: true, }, }, Metadata: "echo/echo.proto", }
Echo_ServiceDesc is the grpc.ServiceDesc for Echo service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_echo_echo_proto protoreflect.FileDescriptor
Functions ¶
func RegisterEchoHandler ¶
RegisterEchoHandler registers the http handlers for service Echo to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterEchoHandlerClient ¶
RegisterEchoHandlerClient registers the http handlers for service Echo to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EchoClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EchoClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "EchoClient" to call the correct interceptors.
func RegisterEchoHandlerFromEndpoint ¶
func RegisterEchoHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterEchoHandlerFromEndpoint is same as RegisterEchoHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterEchoHandlerServer ¶
RegisterEchoHandlerServer registers the http handlers for service Echo to "mux". UnaryRPC :call EchoServer 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 RegisterEchoHandlerFromEndpoint instead.
func RegisterEchoServer ¶
func RegisterEchoServer(s grpc.ServiceRegistrar, srv EchoServer)
Types ¶
type EchoClient ¶
type EchoClient interface { // Hello greets. Hello(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (*HelloResponse, error) // HeeloStream greets repeatedly. HelloStream(ctx context.Context, in *HelloRequest, opts ...grpc.CallOption) (Echo_HelloStreamClient, error) }
EchoClient is the client API for Echo 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 NewEchoClient ¶
func NewEchoClient(cc grpc.ClientConnInterface) EchoClient
type EchoServer ¶
type EchoServer interface { // Hello greets. Hello(context.Context, *HelloRequest) (*HelloResponse, error) // HeeloStream greets repeatedly. HelloStream(*HelloRequest, Echo_HelloStreamServer) error // contains filtered or unexported methods }
EchoServer is the server API for Echo service. All implementations must embed UnimplementedEchoServer for forward compatibility
type Echo_HelloStreamClient ¶
type Echo_HelloStreamClient interface { Recv() (*HelloResponse, error) grpc.ClientStream }
type Echo_HelloStreamServer ¶
type Echo_HelloStreamServer interface { Send(*HelloResponse) error grpc.ServerStream }
type HelloRequest ¶
type HelloRequest struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` // contains filtered or unexported fields }
func (*HelloRequest) Descriptor
deprecated
func (*HelloRequest) Descriptor() ([]byte, []int)
Deprecated: Use HelloRequest.ProtoReflect.Descriptor instead.
func (*HelloRequest) GetMessage ¶
func (x *HelloRequest) GetMessage() string
func (*HelloRequest) ProtoMessage ¶
func (*HelloRequest) ProtoMessage()
func (*HelloRequest) ProtoReflect ¶
func (x *HelloRequest) ProtoReflect() protoreflect.Message
func (*HelloRequest) Reset ¶
func (x *HelloRequest) Reset()
func (*HelloRequest) String ¶
func (x *HelloRequest) String() string
type HelloResponse ¶
type HelloResponse struct { Response string `protobuf:"bytes,1,opt,name=response,proto3" json:"response,omitempty"` // contains filtered or unexported fields }
func (*HelloResponse) Descriptor
deprecated
func (*HelloResponse) Descriptor() ([]byte, []int)
Deprecated: Use HelloResponse.ProtoReflect.Descriptor instead.
func (*HelloResponse) GetResponse ¶
func (x *HelloResponse) GetResponse() string
func (*HelloResponse) ProtoMessage ¶
func (*HelloResponse) ProtoMessage()
func (*HelloResponse) ProtoReflect ¶
func (x *HelloResponse) ProtoReflect() protoreflect.Message
func (*HelloResponse) Reset ¶
func (x *HelloResponse) Reset()
func (*HelloResponse) String ¶
func (x *HelloResponse) String() string
type Server ¶
type Server struct {
UnimplementedEchoServer
}
Server implements the server-side of gRPC demo Phone service.
func (*Server) Hello ¶
func (*Server) Hello(ctx context.Context, req *HelloRequest) (*HelloResponse, error)
Hello is a demo echo service.
func (*Server) HelloStream ¶
func (s *Server) HelloStream(req *HelloRequest, stream Echo_HelloStreamServer) error
HelloStream streaming RPC handler.
type UnimplementedEchoServer ¶
type UnimplementedEchoServer struct { }
UnimplementedEchoServer must be embedded to have forward compatible implementations.
func (UnimplementedEchoServer) Hello ¶
func (UnimplementedEchoServer) Hello(context.Context, *HelloRequest) (*HelloResponse, error)
func (UnimplementedEchoServer) HelloStream ¶
func (UnimplementedEchoServer) HelloStream(*HelloRequest, Echo_HelloStreamServer) error
type UnsafeEchoServer ¶
type UnsafeEchoServer interface {
// contains filtered or unexported methods
}
UnsafeEchoServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to EchoServer will result in compilation errors.