proto

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_print_proto protoreflect.FileDescriptor

Functions

func Init

func Init(host string, timeout int64, opts ...rpcx.ClientOption)

func RegisterPrintServiceHandler

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

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

func RegisterPrintServiceHandlerClient

func RegisterPrintServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client PrintServiceClient) error

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

func RegisterPrintServiceHandlerFromEndpoint

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

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

func RegisterPrintServiceHandlerServer

func RegisterPrintServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server PrintServiceServer) error

RegisterPrintServiceHandlerServer registers the http handlers for service PrintService to "mux". UnaryRPC :call PrintServiceServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906.

func RegisterPrintServiceServer

func RegisterPrintServiceServer(s *grpc.Server, srv PrintServiceServer)

Types

type PrintServiceClient

type PrintServiceClient interface {
	PrintOK(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
}

PrintServiceClient is the client API for PrintService service.

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

type PrintServiceServer

type PrintServiceServer interface {
	PrintOK(context.Context, *Request) (*Response, error)
}

PrintServiceServer is the server API for PrintService service.

type Request

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

func (*Request) Descriptor deprecated

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

Deprecated: Use Request.ProtoReflect.Descriptor instead.

func (*Request) GetMessage

func (x *Request) GetMessage() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) ProtoReflect

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

func (*Request) Reset

func (x *Request) Reset()

func (*Request) String

func (x *Request) String() string

type Response

type Response struct {
	Code    uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
	Data    string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
	Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func PrintOk

func PrintOk(in *Request, trace istio.TraceHeader) (*Response, error)

func (*Response) Descriptor deprecated

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

Deprecated: Use Response.ProtoReflect.Descriptor instead.

func (*Response) GetCode

func (x *Response) GetCode() uint32

func (*Response) GetData

func (x *Response) GetData() string

func (*Response) GetMessage

func (x *Response) GetMessage() string

func (*Response) ProtoMessage

func (*Response) ProtoMessage()

func (*Response) ProtoReflect

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

func (*Response) Reset

func (x *Response) Reset()

func (*Response) String

func (x *Response) String() string

type UnimplementedPrintServiceServer

type UnimplementedPrintServiceServer struct {
}

UnimplementedPrintServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedPrintServiceServer) PrintOK

Jump to

Keyboard shortcuts

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