Documentation ¶
Overview ¶
Package counter is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Variables
- func RegisterCounterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterCounterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CounterClient) error
- func RegisterCounterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterCounterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CounterServer) error
- func RegisterCounterServer(s grpc.ServiceRegistrar, srv CounterServer)
- type CounterClient
- type CounterServer
- type Domain
- type Response
- type Stats
- type UnimplementedCounterServer
- type UnsafeCounterServer
Constants ¶
This section is empty.
Variables ¶
var Counter_ServiceDesc = grpc.ServiceDesc{ ServiceName: "counter.Counter", HandlerType: (*CounterServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "AddDomain", Handler: _Counter_AddDomain_Handler, }, { MethodName: "RemoveDomain", Handler: _Counter_RemoveDomain_Handler, }, { MethodName: "GetStat", Handler: _Counter_GetStat_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "counter/counter.proto", }
Counter_ServiceDesc is the grpc.ServiceDesc for Counter service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_counter_counter_proto protoreflect.FileDescriptor
Functions ¶
func RegisterCounterHandler ¶
func RegisterCounterHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterCounterHandler registers the http handlers for service Counter to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterCounterHandlerClient ¶
func RegisterCounterHandlerClient(ctx context.Context, mux *runtime.ServeMux, client CounterClient) error
RegisterCounterHandlerClient registers the http handlers for service Counter to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "CounterClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "CounterClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "CounterClient" to call the correct interceptors.
func RegisterCounterHandlerFromEndpoint ¶
func RegisterCounterHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterCounterHandlerFromEndpoint is same as RegisterCounterHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterCounterHandlerServer ¶
func RegisterCounterHandlerServer(ctx context.Context, mux *runtime.ServeMux, server CounterServer) error
RegisterCounterHandlerServer registers the http handlers for service Counter to "mux". UnaryRPC :call CounterServer 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 RegisterCounterHandlerFromEndpoint instead.
func RegisterCounterServer ¶
func RegisterCounterServer(s grpc.ServiceRegistrar, srv CounterServer)
Types ¶
type CounterClient ¶
type CounterClient interface { // Adding domain to service AddDomain(ctx context.Context, in *Domain, opts ...grpc.CallOption) (*Response, error) // Remove domain from service RemoveDomain(ctx context.Context, in *Domain, opts ...grpc.CallOption) (*Response, error) // Get stats from domain GetStat(ctx context.Context, in *Domain, opts ...grpc.CallOption) (*Stats, error) }
CounterClient is the client API for Counter 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 NewCounterClient ¶
func NewCounterClient(cc grpc.ClientConnInterface) CounterClient
type CounterServer ¶
type CounterServer interface { // Adding domain to service AddDomain(context.Context, *Domain) (*Response, error) // Remove domain from service RemoveDomain(context.Context, *Domain) (*Response, error) // Get stats from domain GetStat(context.Context, *Domain) (*Stats, error) // contains filtered or unexported methods }
CounterServer is the server API for Counter service. All implementations must embed UnimplementedCounterServer for forward compatibility
type Domain ¶
type Domain struct { Domain string `protobuf:"bytes,1,opt,name=domain,proto3" json:"domain,omitempty"` // contains filtered or unexported fields }
func (*Domain) Descriptor
deprecated
func (*Domain) ProtoMessage ¶
func (*Domain) ProtoMessage()
func (*Domain) ProtoReflect ¶
func (x *Domain) ProtoReflect() protoreflect.Message
type Response ¶
type Response struct { Status string `protobuf:"bytes,1,opt,name=status,proto3" json:"status,omitempty"` // contains filtered or unexported fields }
func (*Response) Descriptor
deprecated
func (*Response) ProtoMessage ¶
func (*Response) ProtoMessage()
func (*Response) ProtoReflect ¶
func (x *Response) ProtoReflect() protoreflect.Message
type Stats ¶
type Stats struct { Cnt int64 `protobuf:"varint,1,opt,name=cnt,proto3" json:"cnt,omitempty"` // contains filtered or unexported fields }
func (*Stats) Descriptor
deprecated
func (*Stats) ProtoMessage ¶
func (*Stats) ProtoMessage()
func (*Stats) ProtoReflect ¶
func (x *Stats) ProtoReflect() protoreflect.Message
type UnimplementedCounterServer ¶
type UnimplementedCounterServer struct { }
UnimplementedCounterServer must be embedded to have forward compatible implementations.
func (UnimplementedCounterServer) RemoveDomain ¶
type UnsafeCounterServer ¶
type UnsafeCounterServer interface {
// contains filtered or unexported methods
}
UnsafeCounterServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to CounterServer will result in compilation errors.