echo

package
v0.0.0-...-9610775 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2020 License: BSD-3-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package echo is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

Functions

func RegisterCalServiceHandler

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

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

func RegisterCalServiceHandlerClient

func RegisterCalServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CalServiceClient) error

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

func RegisterCalServiceHandlerFromEndpoint

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

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

func RegisterCalServiceHandlerServer

func RegisterCalServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CalServiceServer) error

RegisterCalServiceHandlerServer registers the http handlers for service CalService to "mux". UnaryRPC :call CalServiceServer 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 RegisterCalServiceHandlerFromEndpoint instead.

func RegisterCalServiceServer

func RegisterCalServiceServer(s *grpc.Server, srv CalServiceServer)

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. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterEchoServiceHandlerFromEndpoint instead.

func RegisterEchoServiceServer

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

Types

type CalReq

type CalReq struct {
	Uid  string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	Info *Info  `protobuf:"bytes,2,opt,name=info,proto3" json:"info,omitempty"`
	// contains filtered or unexported fields
}

func (*CalReq) Descriptor deprecated

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

Deprecated: Use CalReq.ProtoReflect.Descriptor instead.

func (*CalReq) GetInfo

func (x *CalReq) GetInfo() *Info

func (*CalReq) GetUid

func (x *CalReq) GetUid() string

func (*CalReq) ProtoMessage

func (*CalReq) ProtoMessage()

func (*CalReq) ProtoReflect

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

func (*CalReq) Reset

func (x *CalReq) Reset()

func (*CalReq) String

func (x *CalReq) String() string

type CalRes

type CalRes struct {
	Uid    string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid,omitempty"`
	Result int64  `protobuf:"varint,2,opt,name=result,proto3" json:"result,omitempty"`
	// contains filtered or unexported fields
}

func (*CalRes) Descriptor deprecated

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

Deprecated: Use CalRes.ProtoReflect.Descriptor instead.

func (*CalRes) GetResult

func (x *CalRes) GetResult() int64

func (*CalRes) GetUid

func (x *CalRes) GetUid() string

func (*CalRes) ProtoMessage

func (*CalRes) ProtoMessage()

func (*CalRes) ProtoReflect

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

func (*CalRes) Reset

func (x *CalRes) Reset()

func (*CalRes) String

func (x *CalRes) String() string

type CalServiceClient

type CalServiceClient interface {
	Cal(ctx context.Context, in *CalReq, opts ...grpc.CallOption) (*CalRes, error)
}

CalServiceClient is the client API for CalService service.

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

func NewCalServiceClient

func NewCalServiceClient(cc grpc.ClientConnInterface) CalServiceClient

type CalServiceServer

type CalServiceServer interface {
	Cal(context.Context, *CalReq) (*CalRes, error)
}

CalServiceServer is the server API for CalService service.

type EchoReq

type EchoReq struct {
	Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
	Age  int32  `protobuf:"varint,3,opt,name=age,proto3" json:"age,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoReq) Descriptor deprecated

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

Deprecated: Use EchoReq.ProtoReflect.Descriptor instead.

func (*EchoReq) GetAge

func (x *EchoReq) GetAge() int32

func (*EchoReq) GetName

func (x *EchoReq) GetName() string

func (*EchoReq) ProtoMessage

func (*EchoReq) ProtoMessage()

func (*EchoReq) ProtoReflect

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

func (*EchoReq) Reset

func (x *EchoReq) Reset()

func (*EchoReq) String

func (x *EchoReq) String() string

type EchoRes

type EchoRes struct {
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Age  int32  `protobuf:"varint,2,opt,name=age,proto3" json:"age,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoRes) Descriptor deprecated

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

Deprecated: Use EchoRes.ProtoReflect.Descriptor instead.

func (*EchoRes) GetAge

func (x *EchoRes) GetAge() int32

func (*EchoRes) GetName

func (x *EchoRes) GetName() string

func (*EchoRes) ProtoMessage

func (*EchoRes) ProtoMessage()

func (*EchoRes) ProtoReflect

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

func (*EchoRes) Reset

func (x *EchoRes) Reset()

func (*EchoRes) String

func (x *EchoRes) String() string

type EchoServiceClient

type EchoServiceClient interface {
	Echo(ctx context.Context, in *EchoReq, opts ...grpc.CallOption) (*EchoRes, 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, *EchoReq) (*EchoRes, error)
}

EchoServiceServer is the server API for EchoService service.

type Info

type Info struct {
	Op string `protobuf:"bytes,1,opt,name=op,proto3" json:"op,omitempty"`
	A  int64  `protobuf:"varint,2,opt,name=a,proto3" json:"a,omitempty"`
	B  int64  `protobuf:"varint,3,opt,name=b,proto3" json:"b,omitempty"`
	// contains filtered or unexported fields
}

func (*Info) Descriptor deprecated

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

Deprecated: Use Info.ProtoReflect.Descriptor instead.

func (*Info) GetA

func (x *Info) GetA() int64

func (*Info) GetB

func (x *Info) GetB() int64

func (*Info) GetOp

func (x *Info) GetOp() string

func (*Info) ProtoMessage

func (*Info) ProtoMessage()

func (*Info) ProtoReflect

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

func (*Info) Reset

func (x *Info) Reset()

func (*Info) String

func (x *Info) String() string

type UnimplementedCalServiceServer

type UnimplementedCalServiceServer struct {
}

UnimplementedCalServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedCalServiceServer) Cal

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