Documentation ¶
Overview ¶
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.Server, srv EchoServer)
- type EchoClient
- type EchoServer
- type Request
- type Response
- type UnimplementedEchoServer
Constants ¶
This section is empty.
Variables ¶
var File_echo_echo_proto protoreflect.FileDescriptor
Functions ¶
func RegisterEchoHandler ¶ added in v0.1.4
RegisterEchoHandler registers the http handlers for service Echo to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterEchoHandlerClient ¶ added in v0.1.4
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 ¶ added in v0.1.4
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 ¶ added in v0.1.4
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.
func RegisterEchoServer ¶
func RegisterEchoServer(s *grpc.Server, srv EchoServer)
Types ¶
type EchoClient ¶
type EchoClient interface { Ping(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) Reverse(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) }
EchoClient is the client API for Echo service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewEchoClient ¶
func NewEchoClient(cc grpc.ClientConnInterface) EchoClient
type EchoServer ¶
type EchoServer interface { Ping(context.Context, *Request) (*Response, error) Reverse(context.Context, *Request) (*Response, error) }
EchoServer is the server API for Echo service.
type Request ¶
type Request struct { // Content of the request. Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // contains filtered or unexported fields }
A Request message.
func (*Request) Descriptor
deprecated
func (*Request) GetContent ¶
func (*Request) ProtoMessage ¶
func (*Request) ProtoMessage()
func (*Request) ProtoReflect ¶ added in v0.1.4
func (x *Request) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { // Content of the response. Content string `protobuf:"bytes,1,opt,name=content,proto3" json:"content,omitempty"` // contains filtered or unexported fields }
A Response message.
func (*Response) Descriptor
deprecated
func (*Response) GetContent ¶
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶ added in v0.1.4
func (x *Response) ProtoReflect() protoreflect.Message
type UnimplementedEchoServer ¶
type UnimplementedEchoServer struct { }
UnimplementedEchoServer can be embedded to have forward compatible implementations.