proto

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package proto is a reverse proxy.

It translates gRPC into JSON-RPC 2.0

Index

Constants

View Source
const (
	EchoService_Echo_FullMethodName = "/proto.EchoService/Echo"
)

Variables

View Source
var (
	EchoType_name = map[int32]string{
		0: "FOO",
		1: "BAR",
	}
	EchoType_value = map[string]int32{
		"FOO": 0,
		"BAR": 1,
	}
)

Enum value maps for EchoType.

View Source
var EchoService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proto.EchoService",
	HandlerType: (*EchoServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Echo",
			Handler:    _EchoService_Echo_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "echo.proto",
}

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

Functions

func RegisterEchoServiceServer

func RegisterEchoServiceServer(s grpc.ServiceRegistrar, srv EchoServiceServer)

Types

type EchoRequest

type EchoRequest struct {
	Name string   `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Type EchoType `protobuf:"varint,2,opt,name=type,proto3,enum=proto.EchoType" json:"type,omitempty"`
	// contains filtered or unexported fields
}

func (*EchoRequest) Descriptor deprecated

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

Deprecated: Use EchoRequest.ProtoReflect.Descriptor instead.

func (*EchoRequest) GetName

func (x *EchoRequest) GetName() string

func (*EchoRequest) GetType added in v0.5.0

func (x *EchoRequest) GetType() EchoType

func (*EchoRequest) ProtoMessage

func (*EchoRequest) ProtoMessage()

func (*EchoRequest) ProtoReflect

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

func (*EchoRequest) Reset

func (x *EchoRequest) Reset()

func (*EchoRequest) String

func (x *EchoRequest) String() string

type EchoResponse

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

func (*EchoResponse) Descriptor deprecated

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

Deprecated: Use EchoResponse.ProtoReflect.Descriptor instead.

func (*EchoResponse) GetMessage

func (x *EchoResponse) GetMessage() string

func (*EchoResponse) ProtoMessage

func (*EchoResponse) ProtoMessage()

func (*EchoResponse) ProtoReflect

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

func (*EchoResponse) Reset

func (x *EchoResponse) Reset()

func (*EchoResponse) String

func (x *EchoResponse) String() string

type EchoServiceClient

type EchoServiceClient interface {
	Echo(ctx context.Context, in *EchoRequest, opts ...grpc.CallOption) (*EchoResponse, error)
}

EchoServiceClient is the client API for EchoService 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.

type EchoServiceJsonRPC added in v0.3.2

type EchoServiceJsonRPC struct {
	// contains filtered or unexported fields
}

func RegisterEchoServiceJsonRPC added in v0.3.2

func RegisterEchoServiceJsonRPC(conn *grpc.ClientConn) *EchoServiceJsonRPC

RegisterEchoServiceJsonRPC register the grpc client EchoService for json-rpc. The handlers forward requests to the grpc endpoint over "conn".

func (*EchoServiceJsonRPC) Methods added in v0.3.2

func (s *EchoServiceJsonRPC) Methods() map[string]func(ctx context.Context, message json.RawMessage) (any, error)

type EchoServiceServer

type EchoServiceServer interface {
	Echo(context.Context, *EchoRequest) (*EchoResponse, error)
	// contains filtered or unexported methods
}

EchoServiceServer is the server API for EchoService service. All implementations must embed UnimplementedEchoServiceServer for forward compatibility

type EchoType added in v0.5.0

type EchoType int32
const (
	EchoType_FOO EchoType = 0
	EchoType_BAR EchoType = 1
)

func (EchoType) Descriptor added in v0.5.0

func (EchoType) Descriptor() protoreflect.EnumDescriptor

func (EchoType) Enum added in v0.5.0

func (x EchoType) Enum() *EchoType

func (EchoType) EnumDescriptor deprecated added in v0.5.0

func (EchoType) EnumDescriptor() ([]byte, []int)

Deprecated: Use EchoType.Descriptor instead.

func (EchoType) Number added in v0.5.0

func (x EchoType) Number() protoreflect.EnumNumber

func (EchoType) String added in v0.5.0

func (x EchoType) String() string

func (EchoType) Type added in v0.5.0

type UnimplementedEchoServiceServer

type UnimplementedEchoServiceServer struct {
}

UnimplementedEchoServiceServer must be embedded to have forward compatible implementations.

func (UnimplementedEchoServiceServer) Echo

type UnsafeEchoServiceServer

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

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

Jump to

Keyboard shortcuts

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