Documentation ¶
Overview ¶
Package hello is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func GetTestApiClient(srv string, opts ...grpc.DialOption) func() (TestApiClient, error)
- func GetTestApiV2Client(srv string, opts ...grpc.DialOption) func() (TestApiV2Client, error)
- func GetTransportClient(srv string, opts ...grpc.DialOption) func() (TransportClient, error)
- func RegisterTestApiHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterTestApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestApiClient) error
- func RegisterTestApiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTestApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestApiServer) error
- func RegisterTestApiServer(s *grpc.Server, srv TestApiServer)
- func RegisterTestApiV2Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterTestApiV2HandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestApiV2Client) error
- func RegisterTestApiV2HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterTestApiV2HandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestApiV2Server) error
- func RegisterTestApiV2Server(s *grpc.Server, srv TestApiV2Server)
- func RegisterTransportServer(s *grpc.Server, srv TransportServer)
- type Message
- type TestApiClient
- type TestApiData
- func (*TestApiData) Descriptor() ([]byte, []int)deprecated
- func (x *TestApiData) GetSrvVersion() string
- func (x *TestApiData) GetVersion() string
- func (*TestApiData) ProtoMessage()
- func (x *TestApiData) ProtoReflect() protoreflect.Message
- func (x *TestApiData) Reset()
- func (x *TestApiData) String() string
- type TestApiOutput
- func (*TestApiOutput) Descriptor() ([]byte, []int)deprecated
- func (x *TestApiOutput) GetCode() int32
- func (x *TestApiOutput) GetData() *TestApiData
- func (x *TestApiOutput) GetMsg() string
- func (x *TestApiOutput) GetNowTime() int64
- func (*TestApiOutput) ProtoMessage()
- func (x *TestApiOutput) ProtoReflect() protoreflect.Message
- func (x *TestApiOutput) Reset()
- func (x *TestApiOutput) String() string
- type TestApiServer
- type TestApiV2Client
- type TestApiV2Server
- type TestReq
- type TransportClient
- type TransportServer
- type Transport_TestStream1Client
- type Transport_TestStream1Server
- type Transport_TestStream2Client
- type Transport_TestStream2Server
- type Transport_TestStreamClient
- type Transport_TestStreamServer
- type UnimplementedTestApiServer
- type UnimplementedTestApiV2Server
- type UnimplementedTransportServer
- func (*UnimplementedTransportServer) TestStream(Transport_TestStreamServer) error
- func (*UnimplementedTransportServer) TestStream1(Transport_TestStream1Server) error
- func (*UnimplementedTransportServer) TestStream2(*Message, Transport_TestStream2Server) error
- func (*UnimplementedTransportServer) TestStream3(context.Context, *Message) (*Message, error)
Constants ¶
This section is empty.
Variables ¶
var File_example_proto_hello_api1_proto protoreflect.FileDescriptor
var File_example_proto_hello_api_proto protoreflect.FileDescriptor
var File_example_proto_hello_transport_proto protoreflect.FileDescriptor
Functions ¶
func GetTestApiClient ¶
func GetTestApiClient(srv string, opts ...grpc.DialOption) func() (TestApiClient, error)
func GetTestApiV2Client ¶
func GetTestApiV2Client(srv string, opts ...grpc.DialOption) func() (TestApiV2Client, error)
func GetTransportClient ¶
func GetTransportClient(srv string, opts ...grpc.DialOption) func() (TransportClient, error)
func RegisterTestApiHandler ¶ added in v0.0.11
func RegisterTestApiHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterTestApiHandler registers the http handlers for service TestApi to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterTestApiHandlerClient ¶ added in v0.0.11
func RegisterTestApiHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestApiClient) error
RegisterTestApiHandlerClient registers the http handlers for service TestApi to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TestApiClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TestApiClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TestApiClient" to call the correct interceptors.
func RegisterTestApiHandlerFromEndpoint ¶ added in v0.0.11
func RegisterTestApiHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterTestApiHandlerFromEndpoint is same as RegisterTestApiHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTestApiHandlerServer ¶ added in v0.0.11
func RegisterTestApiHandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestApiServer) error
RegisterTestApiHandlerServer registers the http handlers for service TestApi to "mux". UnaryRPC :call TestApiServer 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 RegisterTestApiHandlerFromEndpoint instead.
func RegisterTestApiServer ¶
func RegisterTestApiServer(s *grpc.Server, srv TestApiServer)
func RegisterTestApiV2Handler ¶ added in v0.0.11
func RegisterTestApiV2Handler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterTestApiV2Handler registers the http handlers for service TestApiV2 to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterTestApiV2HandlerClient ¶ added in v0.0.11
func RegisterTestApiV2HandlerClient(ctx context.Context, mux *runtime.ServeMux, client TestApiV2Client) error
RegisterTestApiV2HandlerClient registers the http handlers for service TestApiV2 to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TestApiV2Client". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TestApiV2Client" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "TestApiV2Client" to call the correct interceptors.
func RegisterTestApiV2HandlerFromEndpoint ¶ added in v0.0.11
func RegisterTestApiV2HandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterTestApiV2HandlerFromEndpoint is same as RegisterTestApiV2Handler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterTestApiV2HandlerServer ¶ added in v0.0.11
func RegisterTestApiV2HandlerServer(ctx context.Context, mux *runtime.ServeMux, server TestApiV2Server) error
RegisterTestApiV2HandlerServer registers the http handlers for service TestApiV2 to "mux". UnaryRPC :call TestApiV2Server 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 RegisterTestApiV2HandlerFromEndpoint instead.
func RegisterTestApiV2Server ¶
func RegisterTestApiV2Server(s *grpc.Server, srv TestApiV2Server)
func RegisterTransportServer ¶
func RegisterTransportServer(s *grpc.Server, srv TransportServer)
Types ¶
type Message ¶
type Message struct { Header map[string]string `` /* 153-byte string literal not displayed */ Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` // contains filtered or unexported fields }
func (*Message) Descriptor
deprecated
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) ProtoReflect ¶
func (x *Message) ProtoReflect() protoreflect.Message
type TestApiClient ¶
type TestApiClient interface { Version(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestApiOutput, error) VersionTest(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestApiOutput, error) }
TestApiClient is the client API for TestApi service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewTestApiClient ¶
func NewTestApiClient(cc grpc.ClientConnInterface) TestApiClient
type TestApiData ¶
type TestApiData struct { Version string `protobuf:"bytes,1,opt,name=version,proto3" json:"version,omitempty"` SrvVersion string `protobuf:"bytes,2,opt,name=srvVersion,proto3" json:"srvVersion,omitempty"` // contains filtered or unexported fields }
func (*TestApiData) Descriptor
deprecated
func (*TestApiData) Descriptor() ([]byte, []int)
Deprecated: Use TestApiData.ProtoReflect.Descriptor instead.
func (*TestApiData) GetSrvVersion ¶
func (x *TestApiData) GetSrvVersion() string
func (*TestApiData) GetVersion ¶
func (x *TestApiData) GetVersion() string
func (*TestApiData) ProtoMessage ¶
func (*TestApiData) ProtoMessage()
func (*TestApiData) ProtoReflect ¶
func (x *TestApiData) ProtoReflect() protoreflect.Message
func (*TestApiData) Reset ¶
func (x *TestApiData) Reset()
func (*TestApiData) String ¶
func (x *TestApiData) String() string
type TestApiOutput ¶
type TestApiOutput struct { Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` Msg string `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"` NowTime int64 `protobuf:"varint,3,opt,name=nowTime,proto3" json:"nowTime,omitempty"` Data *TestApiData `protobuf:"bytes,4,opt,name=data,proto3" json:"data,omitempty"` // contains filtered or unexported fields }
func (*TestApiOutput) Descriptor
deprecated
func (*TestApiOutput) Descriptor() ([]byte, []int)
Deprecated: Use TestApiOutput.ProtoReflect.Descriptor instead.
func (*TestApiOutput) GetCode ¶
func (x *TestApiOutput) GetCode() int32
func (*TestApiOutput) GetData ¶
func (x *TestApiOutput) GetData() *TestApiData
func (*TestApiOutput) GetMsg ¶
func (x *TestApiOutput) GetMsg() string
func (*TestApiOutput) GetNowTime ¶
func (x *TestApiOutput) GetNowTime() int64
func (*TestApiOutput) ProtoMessage ¶
func (*TestApiOutput) ProtoMessage()
func (*TestApiOutput) ProtoReflect ¶
func (x *TestApiOutput) ProtoReflect() protoreflect.Message
func (*TestApiOutput) Reset ¶
func (x *TestApiOutput) Reset()
func (*TestApiOutput) String ¶
func (x *TestApiOutput) String() string
type TestApiServer ¶
type TestApiServer interface { Version(context.Context, *TestReq) (*TestApiOutput, error) VersionTest(context.Context, *TestReq) (*TestApiOutput, error) }
TestApiServer is the server API for TestApi service.
type TestApiV2Client ¶
type TestApiV2Client interface { Version1(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestApiOutput, error) VersionTest1(ctx context.Context, in *TestReq, opts ...grpc.CallOption) (*TestApiOutput, error) }
TestApiV2Client is the client API for TestApiV2 service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewTestApiV2Client ¶
func NewTestApiV2Client(cc grpc.ClientConnInterface) TestApiV2Client
type TestApiV2Server ¶
type TestApiV2Server interface { Version1(context.Context, *TestReq) (*TestApiOutput, error) VersionTest1(context.Context, *TestReq) (*TestApiOutput, error) }
TestApiV2Server is the server API for TestApiV2 service.
type TestReq ¶
type TestReq struct { Input string `protobuf:"bytes,1,opt,name=input,proto3" json:"input,omitempty"` // contains filtered or unexported fields }
func (*TestReq) Descriptor
deprecated
func (*TestReq) ProtoMessage ¶
func (*TestReq) ProtoMessage()
func (*TestReq) ProtoReflect ¶
func (x *TestReq) ProtoReflect() protoreflect.Message
type TransportClient ¶
type TransportClient interface { TestStream(ctx context.Context, opts ...grpc.CallOption) (Transport_TestStreamClient, error) TestStream1(ctx context.Context, opts ...grpc.CallOption) (Transport_TestStream1Client, error) TestStream2(ctx context.Context, in *Message, opts ...grpc.CallOption) (Transport_TestStream2Client, error) TestStream3(ctx context.Context, in *Message, opts ...grpc.CallOption) (*Message, error) }
TransportClient is the client API for Transport service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
func NewTransportClient ¶
func NewTransportClient(cc grpc.ClientConnInterface) TransportClient
type TransportServer ¶
type TransportServer interface { TestStream(Transport_TestStreamServer) error TestStream1(Transport_TestStream1Server) error TestStream2(*Message, Transport_TestStream2Server) error TestStream3(context.Context, *Message) (*Message, error) }
TransportServer is the server API for Transport service.
type Transport_TestStream2Client ¶
type Transport_TestStream2Client interface { Recv() (*Message, error) grpc.ClientStream }
type Transport_TestStream2Server ¶
type Transport_TestStream2Server interface { Send(*Message) error grpc.ServerStream }
type UnimplementedTestApiServer ¶
type UnimplementedTestApiServer struct { }
UnimplementedTestApiServer can be embedded to have forward compatible implementations.
func (*UnimplementedTestApiServer) Version ¶
func (*UnimplementedTestApiServer) Version(context.Context, *TestReq) (*TestApiOutput, error)
func (*UnimplementedTestApiServer) VersionTest ¶
func (*UnimplementedTestApiServer) VersionTest(context.Context, *TestReq) (*TestApiOutput, error)
type UnimplementedTestApiV2Server ¶
type UnimplementedTestApiV2Server struct { }
UnimplementedTestApiV2Server can be embedded to have forward compatible implementations.
func (*UnimplementedTestApiV2Server) Version1 ¶
func (*UnimplementedTestApiV2Server) Version1(context.Context, *TestReq) (*TestApiOutput, error)
func (*UnimplementedTestApiV2Server) VersionTest1 ¶
func (*UnimplementedTestApiV2Server) VersionTest1(context.Context, *TestReq) (*TestApiOutput, error)
type UnimplementedTransportServer ¶
type UnimplementedTransportServer struct { }
UnimplementedTransportServer can be embedded to have forward compatible implementations.
func (*UnimplementedTransportServer) TestStream ¶
func (*UnimplementedTransportServer) TestStream(Transport_TestStreamServer) error
func (*UnimplementedTransportServer) TestStream1 ¶
func (*UnimplementedTransportServer) TestStream1(Transport_TestStream1Server) error
func (*UnimplementedTransportServer) TestStream2 ¶
func (*UnimplementedTransportServer) TestStream2(*Message, Transport_TestStream2Server) error