Documentation ¶
Overview ¶
Package proxy is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterAPIHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterAPIHandlerClient(ctx context.Context, mux *runtime.ServeMux, client APIClient) error
- func RegisterAPIHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterAPIHandlerServer(ctx context.Context, mux *runtime.ServeMux, server APIServer) error
- func RegisterAPIServer(s grpc.ServiceRegistrar, srv APIServer)
- type APIClient
- type APIServer
- type API_ListenClient
- type API_ListenServer
- type ListenRequest
- func (*ListenRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ListenRequest) GetChannel() string
- func (x *ListenRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error
- func (*ListenRequest) ProtoMessage()
- func (x *ListenRequest) ProtoReflect() protoreflect.Message
- func (x *ListenRequest) Reset()
- func (x *ListenRequest) String() string
- func (m *ListenRequest) Validate() error
- func (m *ListenRequest) ValidateAll() error
- type ListenRequestMultiError
- type ListenRequestValidationError
- func (e ListenRequestValidationError) Cause() error
- func (e ListenRequestValidationError) Error() string
- func (e ListenRequestValidationError) ErrorName() string
- func (e ListenRequestValidationError) Field() string
- func (e ListenRequestValidationError) Key() bool
- func (e ListenRequestValidationError) Reason() string
- type ListenResponse
- func (*ListenResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ListenResponse) GetExtra() string
- func (x *ListenResponse) MarshalLogObject(enc zapcore.ObjectEncoder) error
- func (*ListenResponse) ProtoMessage()
- func (x *ListenResponse) ProtoReflect() protoreflect.Message
- func (x *ListenResponse) Reset()
- func (x *ListenResponse) String() string
- func (m *ListenResponse) Validate() error
- func (m *ListenResponse) ValidateAll() error
- type ListenResponseMultiError
- type ListenResponseValidationError
- func (e ListenResponseValidationError) Cause() error
- func (e ListenResponseValidationError) Error() string
- func (e ListenResponseValidationError) ErrorName() string
- func (e ListenResponseValidationError) Field() string
- func (e ListenResponseValidationError) Key() bool
- func (e ListenResponseValidationError) Reason() string
- type UnimplementedAPIServer
- type UnsafeAPIServer
Constants ¶
const (
API_Listen_FullMethodName = "/proxy.API/Listen"
)
Variables ¶
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)
var File_proxy_proxy_proto protoreflect.FileDescriptor
Functions ¶
func RegisterAPIHandler ¶ added in v2.8.0
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
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
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
func (e ListenRequestValidationError) Cause() error
Cause function returns cause value.
func (ListenRequestValidationError) Error ¶ added in v2.8.0
func (e ListenRequestValidationError) Error() string
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
func (e ListenRequestValidationError) Field() string
Field function returns field value.
func (ListenRequestValidationError) Key ¶ added in v2.8.0
func (e ListenRequestValidationError) Key() bool
Key function returns key value.
func (ListenRequestValidationError) Reason ¶ added in v2.8.0
func (e ListenRequestValidationError) Reason() string
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
func (e ListenResponseValidationError) Cause() error
Cause function returns cause value.
func (ListenResponseValidationError) Error ¶ added in v2.8.0
func (e ListenResponseValidationError) Error() string
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
func (e ListenResponseValidationError) Field() string
Field function returns field value.
func (ListenResponseValidationError) Key ¶ added in v2.8.0
func (e ListenResponseValidationError) Key() bool
Key function returns key value.
func (ListenResponseValidationError) Reason ¶ added in v2.8.0
func (e ListenResponseValidationError) Reason() string
Reason function returns reason value.
type UnimplementedAPIServer ¶
type UnimplementedAPIServer struct { }
UnimplementedAPIServer must be embedded to have forward compatible implementations.
func (UnimplementedAPIServer) Listen ¶
func (UnimplementedAPIServer) Listen(*ListenRequest, API_ListenServer) error
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.