proxy

package
v2.9.4 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Package proxy is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	API_Listen_FullMethodName = "/proxy.API/Listen"
)

Variables

View Source
var API_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "proxy.API",
	HandlerType: (*APIServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Listen",
			Handler:       _API_Listen_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "proxy/proxy.proto",
}

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

View Source
var File_proxy_proxy_proto protoreflect.FileDescriptor

Functions

func RegisterAPIHandler added in v2.8.0

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

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

func RegisterAPIHandlerClient added in v2.8.0

func RegisterAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client APIClient) error

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

func RegisterAPIHandlerFromEndpoint added in v2.8.0

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

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

func RegisterAPIHandlerServer added in v2.8.0

func RegisterAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server APIServer) error

RegisterAPIHandlerServer registers the http handlers for service API to "mux". UnaryRPC :call APIServer 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 RegisterAPIHandlerFromEndpoint instead.

func RegisterAPIServer

func RegisterAPIServer(s grpc.ServiceRegistrar, srv APIServer)

Types

type APIClient

type APIClient interface {
	// Listen streams database events.
	// It signals that it is internally set up by sending an initial empty ListenResponse.
	Listen(ctx context.Context, in *ListenRequest, opts ...grpc.CallOption) (API_ListenClient, error)
}

APIClient is the client API for API 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 NewAPIClient

func NewAPIClient(cc grpc.ClientConnInterface) APIClient

type APIServer

type APIServer interface {
	// Listen streams database events.
	// It signals that it is internally set up by sending an initial empty ListenResponse.
	Listen(*ListenRequest, API_ListenServer) error
	// contains filtered or unexported methods
}

APIServer is the server API for API service. All implementations must embed UnimplementedAPIServer for forward compatibility

type API_ListenClient

type API_ListenClient interface {
	Recv() (*ListenResponse, error)
	grpc.ClientStream
}

type API_ListenServer

type API_ListenServer interface {
	Send(*ListenResponse) error
	grpc.ServerStream
}

type ListenRequest

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

func (*ListenRequest) Descriptor deprecated

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

Deprecated: Use ListenRequest.ProtoReflect.Descriptor instead.

func (*ListenRequest) GetChannel

func (x *ListenRequest) GetChannel() string

func (*ListenRequest) MarshalLogObject

func (x *ListenRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*ListenRequest) ProtoMessage

func (*ListenRequest) ProtoMessage()

func (*ListenRequest) ProtoReflect added in v2.7.0

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

func (*ListenRequest) Reset

func (x *ListenRequest) Reset()

func (*ListenRequest) String

func (x *ListenRequest) String() string

func (*ListenRequest) Validate added in v2.8.0

func (m *ListenRequest) Validate() error

Validate checks the field values on ListenRequest with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ListenRequest) ValidateAll added in v2.8.0

func (m *ListenRequest) ValidateAll() error

ValidateAll checks the field values on ListenRequest with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ListenRequestMultiError, or nil if none found.

type ListenRequestMultiError added in v2.8.0

type ListenRequestMultiError []error

ListenRequestMultiError is an error wrapping multiple validation errors returned by ListenRequest.ValidateAll() if the designated constraints aren't met.

func (ListenRequestMultiError) AllErrors added in v2.8.0

func (m ListenRequestMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ListenRequestMultiError) Error added in v2.8.0

func (m ListenRequestMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ListenRequestValidationError added in v2.8.0

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

ListenRequestValidationError is the validation error returned by ListenRequest.Validate if the designated constraints aren't met.

func (ListenRequestValidationError) Cause added in v2.8.0

Cause function returns cause value.

func (ListenRequestValidationError) Error added in v2.8.0

Error satisfies the builtin error interface

func (ListenRequestValidationError) ErrorName added in v2.8.0

func (e ListenRequestValidationError) ErrorName() string

ErrorName returns error name.

func (ListenRequestValidationError) Field added in v2.8.0

Field function returns field value.

func (ListenRequestValidationError) Key added in v2.8.0

Key function returns key value.

func (ListenRequestValidationError) Reason added in v2.8.0

Reason function returns reason value.

type ListenResponse

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

func (*ListenResponse) Descriptor deprecated

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

Deprecated: Use ListenResponse.ProtoReflect.Descriptor instead.

func (*ListenResponse) GetExtra

func (x *ListenResponse) GetExtra() string

func (*ListenResponse) MarshalLogObject

func (x *ListenResponse) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*ListenResponse) ProtoMessage

func (*ListenResponse) ProtoMessage()

func (*ListenResponse) ProtoReflect added in v2.7.0

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

func (*ListenResponse) Reset

func (x *ListenResponse) Reset()

func (*ListenResponse) String

func (x *ListenResponse) String() string

func (*ListenResponse) Validate added in v2.8.0

func (m *ListenResponse) Validate() error

Validate checks the field values on ListenResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*ListenResponse) ValidateAll added in v2.8.0

func (m *ListenResponse) ValidateAll() error

ValidateAll checks the field values on ListenResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in ListenResponseMultiError, or nil if none found.

type ListenResponseMultiError added in v2.8.0

type ListenResponseMultiError []error

ListenResponseMultiError is an error wrapping multiple validation errors returned by ListenResponse.ValidateAll() if the designated constraints aren't met.

func (ListenResponseMultiError) AllErrors added in v2.8.0

func (m ListenResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (ListenResponseMultiError) Error added in v2.8.0

func (m ListenResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type ListenResponseValidationError added in v2.8.0

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

ListenResponseValidationError is the validation error returned by ListenResponse.Validate if the designated constraints aren't met.

func (ListenResponseValidationError) Cause added in v2.8.0

Cause function returns cause value.

func (ListenResponseValidationError) Error added in v2.8.0

Error satisfies the builtin error interface

func (ListenResponseValidationError) ErrorName added in v2.8.0

func (e ListenResponseValidationError) ErrorName() string

ErrorName returns error name.

func (ListenResponseValidationError) Field added in v2.8.0

Field function returns field value.

func (ListenResponseValidationError) Key added in v2.8.0

Key function returns key value.

func (ListenResponseValidationError) Reason added in v2.8.0

Reason function returns reason value.

type UnimplementedAPIServer

type UnimplementedAPIServer struct {
}

UnimplementedAPIServer must be embedded to have forward compatible implementations.

func (UnimplementedAPIServer) Listen

type UnsafeAPIServer added in v2.7.0

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

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

Jump to

Keyboard shortcuts

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