proto

package
v0.0.0-...-b563d55 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2020 License: Apache-2.0 Imports: 17 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_example_proto_echo_proto protoreflect.FileDescriptor
View Source
var File_example_proto_messages_proto protoreflect.FileDescriptor

Functions

func RegisterEchoHandler

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

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

func RegisterEchoHandlerClient

func RegisterEchoHandlerClient(ctx context.Context, mux *runtime.ServeMux, client EchoClient) error

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

func RegisterEchoHandlerServer(ctx context.Context, mux *runtime.ServeMux, server EchoServer) error

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 {
	// Echo relays the message passed in back to the caller.
	Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
	// EchoStream relays the message passed in back to the caller.
	EchoStream(ctx context.Context, opts ...grpc.CallOption) (Echo_EchoStreamClient, 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 EchoRequest

type EchoRequest struct {

	// Message to send to server.
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoRequest) Descriptor deprecated

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

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetMessage

func (x *EchoRequest) GetMessage() string

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect

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

func (*EchoRequest) Reset

func (x *EchoRequest) Reset()

func (*EchoRequest) String

func (x *EchoRequest) String() string

type EchoResponse

type EchoResponse struct {

	// Message the server responds with.
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoResponse) Descriptor deprecated

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

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetMessage

func (x *EchoResponse) GetMessage() string

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) ProtoReflect

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

func (*EchoResponse) Reset

func (x *EchoResponse) Reset()

func (*EchoResponse) String

func (x *EchoResponse) String() string

type EchoServer

type EchoServer interface {
	// Echo relays the message passed in back to the caller.
	Echo(context.Context, *EchoRequest) (*EchoResponse, error)
	// EchoStream relays the message passed in back to the caller.
	EchoStream(Echo_EchoStreamServer) error
}

EchoServer is the server API for Echo service.

type Echo_EchoStreamClient

type Echo_EchoStreamClient interface {
	Send(*EchoRequest) error
	Recv() (*EchoResponse, error)
	grpc.ClientStream
}

type Echo_EchoStreamServer

type Echo_EchoStreamServer interface {
	Send(*EchoResponse) error
	Recv() (*EchoRequest, error)
	grpc.ServerStream
}

type UnimplementedEchoServer

type UnimplementedEchoServer struct {
}

UnimplementedEchoServer can be embedded to have forward compatible implementations.

func (*UnimplementedEchoServer) Echo

func (*UnimplementedEchoServer) EchoStream

Jump to

Keyboard shortcuts

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