grpc_translator

package
v0.0.0-...-08d9cd0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2023 License: Apache-2.0 Imports: 16 Imported by: 1

Documentation

Overview

Package grpc_translator is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_grpc_translator_grpc_translator_proto protoreflect.FileDescriptor
View Source
var Frontend_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "grpc_translator.Frontend",
	HandlerType: (*FrontendServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Homepage",
			Handler:    _Frontend_Homepage_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "grpc-translator/grpc-translator.proto",
}

Frontend_ServiceDesc is the grpc.ServiceDesc for Frontend service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterFrontendHandler

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

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

func RegisterFrontendHandlerClient

func RegisterFrontendHandlerClient(ctx context.Context, mux *runtime.ServeMux, client FrontendClient) error

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

func RegisterFrontendHandlerFromEndpoint

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

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

func RegisterFrontendHandlerServer

func RegisterFrontendHandlerServer(ctx context.Context, mux *runtime.ServeMux, server FrontendServer) error

RegisterFrontendHandlerServer registers the http handlers for service Frontend to "mux". UnaryRPC :call FrontendServer 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 RegisterFrontendHandlerFromEndpoint instead.

func RegisterFrontendServer

func RegisterFrontendServer(s grpc.ServiceRegistrar, srv FrontendServer)

Types

type FrontendClient

type FrontendClient interface {
	// Homepage rpc
	Homepage(ctx context.Context, in *HomepageRequest, opts ...grpc.CallOption) (*HomepageRespone, error)
}

FrontendClient is the client API for Frontend 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 NewFrontendClient

func NewFrontendClient(cc grpc.ClientConnInterface) FrontendClient

type FrontendServer

type FrontendServer interface {
	// Homepage rpc
	Homepage(context.Context, *HomepageRequest) (*HomepageRespone, error)
	// contains filtered or unexported methods
}

FrontendServer is the server API for Frontend service. All implementations must embed UnimplementedFrontendServer for forward compatibility

type HomepageRequest

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

func (*HomepageRequest) Descriptor deprecated

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

Deprecated: Use HomepageRequest.ProtoReflect.Descriptor instead.

func (*HomepageRequest) GetMessage

func (x *HomepageRequest) GetMessage() string

func (*HomepageRequest) ProtoMessage

func (*HomepageRequest) ProtoMessage()

func (*HomepageRequest) ProtoReflect

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

func (*HomepageRequest) Reset

func (x *HomepageRequest) Reset()

func (*HomepageRequest) String

func (x *HomepageRequest) String() string

type HomepageRespone

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

func (*HomepageRespone) Descriptor deprecated

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

Deprecated: Use HomepageRespone.ProtoReflect.Descriptor instead.

func (*HomepageRespone) GetMessage

func (x *HomepageRespone) GetMessage() string

func (*HomepageRespone) ProtoMessage

func (*HomepageRespone) ProtoMessage()

func (*HomepageRespone) ProtoReflect

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

func (*HomepageRespone) Reset

func (x *HomepageRespone) Reset()

func (*HomepageRespone) String

func (x *HomepageRespone) String() string

type UnimplementedFrontendServer

type UnimplementedFrontendServer struct {
}

UnimplementedFrontendServer must be embedded to have forward compatible implementations.

func (UnimplementedFrontendServer) Homepage

type UnsafeFrontendServer

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

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

Jump to

Keyboard shortcuts

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