demopackage

package
v1.0.35 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 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_http_server_proto_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 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://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewDemoClient

func NewDemoClient(cc grpc.ClientConnInterface) DemoClient

type DemoServer

type DemoServer interface {
	Ping(context.Context, *PingRequest) (*PongResponse, error)
	// contains filtered or unexported methods
}

DemoServer is the server API for Demo service. All implementations must embed UnimplementedDemoServer for forward compatibility

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 must be embedded to have forward compatible implementations.

func (UnimplementedDemoServer) Ping

type UnsafeDemoServer

type UnsafeDemoServer interface {
	// contains filtered or unexported methods
}

UnsafeDemoServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DemoServer will result in compilation errors.

Jump to

Keyboard shortcuts

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