demopackage

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package demopackage is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_service_proto protoreflect.FileDescriptor

Functions

func RegisterDemoHandler

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

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

func RegisterDemoHandlerClient

func RegisterDemoHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DemoClient) error

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

func RegisterDemoHandlerFromEndpoint

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

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

func RegisterDemoHandlerServer

func RegisterDemoHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DemoServer) error

RegisterDemoHandlerServer registers the http handlers for service Demo to "mux". UnaryRPC :call DemoServer 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 (such as grpc.SendHeader, etc) to stop working. Consider using RegisterDemoHandlerFromEndpoint instead.

func RegisterDemoServer

func RegisterDemoServer(s *grpc.Server, srv DemoServer)

Types

type DemoClient

type DemoClient interface {
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PongResponse, error)
}

DemoClient is the client API for Demo service.

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

func NewDemoClient

func NewDemoClient(cc grpc.ClientConnInterface) DemoClient

type DemoServer

type DemoServer interface {
	Ping(context.Context, *PingRequest) (*PongResponse, error)
}

DemoServer is the server API for Demo service.

type PingRequest

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

func (*PingRequest) Descriptor deprecated

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

Deprecated: Use PingRequest.ProtoReflect.Descriptor instead.

func (*PingRequest) GetIn

func (x *PingRequest) GetIn() string

func (*PingRequest) ProtoMessage

func (*PingRequest) ProtoMessage()

func (*PingRequest) ProtoReflect

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

func (*PingRequest) Reset

func (x *PingRequest) Reset()

func (*PingRequest) String

func (x *PingRequest) String() string

type PongResponse

type PongResponse struct {
	Out string `protobuf:"bytes,2,opt,name=out,proto3" json:"out,omitempty"`
	// contains filtered or unexported fields
}

func (*PongResponse) Descriptor deprecated

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

Deprecated: Use PongResponse.ProtoReflect.Descriptor instead.

func (*PongResponse) GetOut

func (x *PongResponse) GetOut() string

func (*PongResponse) ProtoMessage

func (*PongResponse) ProtoMessage()

func (*PongResponse) ProtoReflect

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

func (*PongResponse) Reset

func (x *PongResponse) Reset()

func (*PongResponse) String

func (x *PongResponse) String() string

type UnimplementedDemoServer

type UnimplementedDemoServer struct {
}

UnimplementedDemoServer can be embedded to have forward compatible implementations.

func (*UnimplementedDemoServer) Ping

Jump to

Keyboard shortcuts

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