proto

package
v0.0.0-...-cc7d4f7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 9, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_proto_echo_service_proto protoreflect.FileDescriptor

Functions

func RegisterEchoServiceHandler

func RegisterEchoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterEchoServiceHandler registers the http handlers for service EchoService to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterEchoServiceHandlerClient

func RegisterEchoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoServiceClient) error

RegisterEchoServiceHandlerClient registers the http handlers for service EchoService to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "EchoServiceClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "EchoServiceClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "EchoServiceClient" to call the correct interceptors.

func RegisterEchoServiceHandlerFromEndpoint

func RegisterEchoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterEchoServiceHandlerFromEndpoint is same as RegisterEchoServiceHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterEchoServiceHandlerServer

func RegisterEchoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServiceServer) error

RegisterEchoServiceHandlerServer registers the http handlers for service EchoService to "mux". UnaryRPC :call EchoServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterEchoServiceServer

func RegisterEchoServiceServer(s *grpc.Server, srv EchoServiceServer)

Types

type EchoServiceClient

type EchoServiceClient interface {
	Echo(ctx context.Context, in *RequestMessage, opts ...grpc.CallOption) (*ResponseMessage, error)
}

EchoServiceClient is the client API for EchoService service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

type EchoServiceServer

type EchoServiceServer interface {
	Echo(context.Context, *RequestMessage) (*ResponseMessage, error)
}

EchoServiceServer is the server API for EchoService service.

type RequestMessage

type RequestMessage struct {
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*RequestMessage) Descriptor deprecated

func (*RequestMessage) Descriptor() ([]byte, []int)

Deprecated: Use RequestMessage.ProtoReflect.Descriptor instead.

func (*RequestMessage) GetMessage

func (x *RequestMessage) GetMessage() string

func (*RequestMessage) ProtoMessage

func (*RequestMessage) ProtoMessage()

func (*RequestMessage) ProtoReflect

func (x *RequestMessage) ProtoReflect() protoreflect.Message

func (*RequestMessage) Reset

func (x *RequestMessage) Reset()

func (*RequestMessage) String

func (x *RequestMessage) String() string

type ResponseMessage

type ResponseMessage struct {
	Host    string `protobuf:"bytes,1,opt,name=host,proto3" json:"host,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*ResponseMessage) Descriptor deprecated

func (*ResponseMessage) Descriptor() ([]byte, []int)

Deprecated: Use ResponseMessage.ProtoReflect.Descriptor instead.

func (*ResponseMessage) GetHost

func (x *ResponseMessage) GetHost() string

func (*ResponseMessage) GetMessage

func (x *ResponseMessage) GetMessage() string

func (*ResponseMessage) ProtoMessage

func (*ResponseMessage) ProtoMessage()

func (*ResponseMessage) ProtoReflect

func (x *ResponseMessage) ProtoReflect() protoreflect.Message

func (*ResponseMessage) Reset

func (x *ResponseMessage) Reset()

func (*ResponseMessage) String

func (x *ResponseMessage) String() string

type UnimplementedEchoServiceServer

type UnimplementedEchoServiceServer struct {
}

UnimplementedEchoServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedEchoServiceServer) Echo

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL