add traffic limiter plugin
This commit is contained in:
105
limiter/traffic/proto/limiter_grpc.pb.go
Normal file
105
limiter/traffic/proto/limiter_grpc.pb.go
Normal file
@ -0,0 +1,105 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.2.0
|
||||
// - protoc v3.15.8
|
||||
// source: limiter.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
// LimiterClient is the client API for Limiter 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 LimiterClient interface {
|
||||
Limit(ctx context.Context, in *LimitRequest, opts ...grpc.CallOption) (*LimitReply, error)
|
||||
}
|
||||
|
||||
type limiterClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewLimiterClient(cc grpc.ClientConnInterface) LimiterClient {
|
||||
return &limiterClient{cc}
|
||||
}
|
||||
|
||||
func (c *limiterClient) Limit(ctx context.Context, in *LimitRequest, opts ...grpc.CallOption) (*LimitReply, error) {
|
||||
out := new(LimitReply)
|
||||
err := c.cc.Invoke(ctx, "/proto.Limiter/Limit", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// LimiterServer is the server API for Limiter service.
|
||||
// All implementations must embed UnimplementedLimiterServer
|
||||
// for forward compatibility
|
||||
type LimiterServer interface {
|
||||
Limit(context.Context, *LimitRequest) (*LimitReply, error)
|
||||
mustEmbedUnimplementedLimiterServer()
|
||||
}
|
||||
|
||||
// UnimplementedLimiterServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedLimiterServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedLimiterServer) Limit(context.Context, *LimitRequest) (*LimitReply, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Limit not implemented")
|
||||
}
|
||||
func (UnimplementedLimiterServer) mustEmbedUnimplementedLimiterServer() {}
|
||||
|
||||
// UnsafeLimiterServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to LimiterServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeLimiterServer interface {
|
||||
mustEmbedUnimplementedLimiterServer()
|
||||
}
|
||||
|
||||
func RegisterLimiterServer(s grpc.ServiceRegistrar, srv LimiterServer) {
|
||||
s.RegisterService(&Limiter_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Limiter_Limit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(LimitRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(LimiterServer).Limit(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.Limiter/Limit",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(LimiterServer).Limit(ctx, req.(*LimitRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Limiter_ServiceDesc is the grpc.ServiceDesc for Limiter service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Limiter_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.Limiter",
|
||||
HandlerType: (*LimiterServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Limit",
|
||||
Handler: _Limiter_Limit_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "limiter.proto",
|
||||
}
|
Reference in New Issue
Block a user