Beispiel #1
0
 public RateLimitCore(
     IOptions <ClientRateLimitingOptions> options,
     IRateLimitCounterStore counterStore)
 {
     _options      = options.Value;
     _counterStore = counterStore;
 }
Beispiel #2
0
        public UrlRateLimitProcessor(UrlRateLimitOptions options, IRateLimitCounterStore counterStore)
        {
            _options      = options;
            _counterStore = counterStore;

            _core = new RateLimitCore(Processor.UrlRateLimit, options, _counterStore);
        }
Beispiel #3
0
 public HomeController(IHostingEnvironment env, SubscriberManager subscriberManager, IpLogger ipLogger, IRateLimitCounterStore rateLimiter)
 {
     this._env = env;
     this._subscriberManager = subscriberManager;
     this._ipLogger          = ipLogger;
     this._rateLimiter       = rateLimiter;
 }
 public RateLimitProcessor(RateLimitOptions options, ICacheManager cacheManager, IPolicyStore policyStore, IRateLimitCounterStore counterStore)
 {
     _options      = options;
     _cacheManager = cacheManager;
     _policyStore  = policyStore;
     _counterStore = counterStore;
 }
Beispiel #5
0
 public RateLimitCore(bool ipRateLimiting,
                      RateLimitCoreOptions options,
                      IRateLimitCounterStore counterStore)
 {
     _ipRateLimiting = ipRateLimiting;
     _options        = options;
     _counterStore   = counterStore;
 }
 public RateLimitCore(Processor rateLimitingProcessor,
                      RateLimitCoreOptions options,
                      IRateLimitCounterStore counterStore)
 {
     _rateLimitingProcessor = rateLimitingProcessor;
     _options      = options;
     _counterStore = counterStore;
 }
 public ClientRateLimitProcessor(ClientRateLimitOptions options,
                                 IRateLimitCounterStore counterStore,
                                 IClientPolicyStore policyStore)
     : base(options, counterStore)
 {
     _options     = options;
     _policyStore = policyStore;
 }
 public MyIpRateLimitMiddleware(RequestDelegate next
                                , IOptions <IpRateLimitOptions> options
                                , IRateLimitCounterStore counterStore
                                , IIpPolicyStore policyStore
                                , IRateLimitConfiguration config
                                , ILogger <IpRateLimitMiddleware> logger)
     : base(next, options, counterStore, policyStore, config, logger)
 {
 }
 public ClientRateLimitProcessor(
     ClientRateLimitOptions options,
     IRateLimitCounterStore counterStore,
     IClientPolicyStore policyStore,
     IRateLimitConfiguration config)
     : base(options, counterStore, new ClientCounterKeyBuilder(options), config)
 {
     _options     = options;
     _policyStore = policyStore;
 }
Beispiel #10
0
 public ClientRateLimitMiddleware(RequestDelegate next,
                                  IRateLimitLoader Loader,
                                  IRateLimitCounterStore counterStore,
                                  IClientPolicyStore policyStore,
                                  IRateLimitConfiguration config,
                                  ILogger <ClientRateLimitMiddleware> logger)
     : base(next, Loader.GetClientRateLimitOptions(), new ClientRateLimitProcessor(Loader.GetClientRateLimitOptions(), counterStore, policyStore, config), config)
 {
     _logger = logger;
 }
Beispiel #11
0
        public UserRateLimitProcessor(UserRateLimitOptions options,
                                      IRateLimitCounterStore counterStore,
                                      IUserPolicyStore policyStore)
        {
            _options      = options;
            _counterStore = counterStore;
            _policyStore  = policyStore;

            _core = new RateLimitCore(false, options, _counterStore);
        }
Beispiel #12
0
 public IpRateLimitProcessor(
     IpRateLimitOptions options,
     IRateLimitCounterStore counterStore,
     IIpPolicyStore policyStore,
     IRateLimitConfiguration config)
     : base(options, counterStore, new IpCounterKeyBuilder(options), config)
 {
     _options     = options;
     _policyStore = policyStore;
 }
Beispiel #13
0
        public ClientRateLimitProcessor(ClientRateLimitOptions options,
                                        IRateLimitCounterStore counterStore,
                                        IClientPolicyStore policyStore)
        {
            _options      = options;
            _counterStore = counterStore;
            _policyStore  = policyStore;

            _core = new RateLimitCore(false, options, _counterStore);
        }
 public ClientRateLimitMiddleware(RequestDelegate next,
                                  IOptions <ClientRateLimitOptions> options,
                                  IRateLimitCounterStore counterStore,
                                  IClientPolicyStore policyStore,
                                  IRateLimitConfiguration config,
                                  ILogger <ClientRateLimitMiddleware> logger)
     : base(next, options?.Value, new ClientRateLimitProcessor(options?.Value, counterStore, policyStore, config), config)
 {
     _logger = logger;
 }
 public MyClientRateLimitMiddleware(RequestDelegate next,
                                    IOptions <ClientRateLimitOptions> options,
                                    IRateLimitCounterStore counterStore,
                                    IClientPolicyStore policyStore,
                                    IRateLimitConfiguration config,
                                    ILogger <ClientRateLimitMiddleware> logger)
     : base(next, options, counterStore, policyStore, config, logger)
 {
     _logger = logger;
 }
Beispiel #16
0
 public CustomIpRateLimitMiddleware(
     RequestDelegate next,
     IOptions <IpRateLimitOptions> options,
     IRateLimitCounterStore counterStore,
     IIpPolicyStore policyStore,
     ILogger <IpRateLimitMiddleware> logger,
     IIpAddressParser ipParser = null
     ) : base(next, options, counterStore, policyStore, logger, ipParser)
 {
     _options = options.Value;
 }
 public IpRateLimitMiddleware(RequestDelegate next,
                              IOptions <IpRateLimitOptions> options,
                              IRateLimitCounterStore counterStore,
                              IIpPolicyStore policyStore,
                              ILogger <IpRateLimitMiddleware> logger)
 {
     _next      = next;
     _options   = options.Value;
     _logger    = logger;
     _processor = new IpRateLimitProcessor(_options, counterStore, policyStore);
 }
 public CustomRateLimitingMiddleware(RequestDelegate next,
                                     IProcessingStrategy processingStrategy,
                                     IOptions <IpRateLimitOptions> options,
                                     IRateLimitCounterStore counterStore,
                                     IIpPolicyStore policyStore,
                                     IRateLimitConfiguration config,
                                     ILogger <IpRateLimitMiddleware> logger)
     : base(next, processingStrategy, options, counterStore, policyStore, config, logger)
 {
     _rateLimitOptions = options.Value;
 }
Beispiel #19
0
        public RedisRateLimitCounterStore(
            IEnv env,
            IMemoryCache memoryCache,
            ILogger <RedisRateLimitCounterStore> logger)
        {
            _logger           = logger;
            _memoryCacheStore = new MemoryCacheRateLimitCounterStore(memoryCache);
            var options = RedisConfiguration.ConfigurationOptions(env);

            _redis = ConnectionMultiplexer.Connect(options);
        }
Beispiel #20
0
 public ClientRateLimitCounterStore(
     IOptions <ClientRateLimitOptions> options,
     IClientRateLimitProcessor clientRateLimitProcessor,
     IRateLimitCounterStore counterStore,
     IClientPolicyStore policyStore)
 {
     _options      = options.Value;
     _processor    = clientRateLimitProcessor;
     _counterStore = counterStore;
     _core         = new RateLimitCore(false, options.Value, _counterStore);
 }
Beispiel #21
0
 protected RateLimitProcessor(
     RateLimitOptions options,
     IRateLimitCounterStore counterStore,
     ICounterKeyBuilder counterKeyBuilder,
     IRateLimitConfiguration config)
 {
     _options           = options;
     _counterStore      = counterStore;
     _counterKeyBuilder = counterKeyBuilder;
     _config            = config;
 }
 public IpRateLimitMiddleware(RequestDelegate next,
                              IProcessingStrategy processingStrategy,
                              IOptions <IpRateLimitOptions> options,
                              IRateLimitCounterStore counterStore,
                              IIpPolicyStore policyStore,
                              IRateLimitConfiguration config,
                              ILogger <IpRateLimitMiddleware> logger
                              )
     : base(next, options?.Value, new IpRateLimitProcessor(options?.Value, counterStore, policyStore, config, processingStrategy), config)
 {
     _logger = logger;
 }
Beispiel #23
0
        public IpRateLimitProcessor(IpRateLimitOptions options,
                                    IRateLimitCounterStore counterStore,
                                    IIpPolicyStore policyStore,
                                    IIpAddressParser ipParser)
        {
            _options      = options;
            _counterStore = counterStore;
            _policyStore  = policyStore;
            _ipParser     = ipParser;

            _core = new RateLimitCore(true, options, _counterStore);
        }
Beispiel #24
0
 public IpRateLimitProcessor(
     IpRateLimitOptions options,
     IRateLimitCounterStore counterStore,
     IIpPolicyStore policyStore,
     IRateLimitConfiguration config,
     IProcessingStrategy processingStrategy)
     : base(options)
 {
     _options            = options;
     _policyStore        = policyStore;
     _counterKeyBuilder  = new IpCounterKeyBuilder(options);
     _processingStrategy = processingStrategy;
 }
Beispiel #25
0
        public UserRateimiterMiddleWare(RequestDelegate next,
                                        IOptions <UserRateLimitOptions> options,
                                        IRateLimitCounterStore counterStore,
                                        IUserPolicyStore policyStore,
                                        ILogger <UserRateimiterMiddleWare> logger
                                        )
        {
            _next    = next;
            _logger  = logger;
            _options = options.Value;

            _processor = new UserRateLimitProcessor(_options, counterStore, policyStore);
        }
        public IpRateLimitMiddleware(RequestDelegate next,
                                     IOptions <IpRateLimitOptions> options,
                                     IRateLimitCounterStore counterStore,
                                     IIpPolicyStore policyStore,
                                     ILogger <IpRateLimitMiddleware> logger,
                                     IIpAddressParser ipParser = null)
        {
            _next     = next;
            _options  = options.Value;
            _logger   = logger;
            _ipParser = ipParser ?? new ReversProxyIpParser(_options.RealIpHeader);

            _processor = new IpRateLimitProcessor(_options, counterStore, policyStore, _ipParser);
        }
 public MyIPRateMiddleware(
     RequestDelegate next,
     IOptions <IpRateLimitOptions> options,
     IRateLimitCounterStore counterStore,
     IIpPolicyStore policyStore,
     ILogger <IpRateLimitMiddleware> logger,
     IIpAddressParser ipParser = null)
 {
     this._next      = next;
     this._options   = options.Value;
     this._logger    = logger;
     this._ipParser  = ipParser != null ? ipParser : (IIpAddressParser) new ReversProxyIpParser(this._options.RealIpHeader);
     this._processor = new IpRateLimitProcessor(this._options, counterStore, policyStore, this._ipParser);
 }
Beispiel #28
0
        public IpRateLimitMiddleware(RequestDelegate next,
                                     IOptions <IpRateLimitOptions> options,
                                     IRateLimitCounterStore counterStore,
                                     IIpPolicyStore policyStore,
                                     IRateLimitConfiguration config,
                                     ILogger <IpRateLimitMiddleware> logger)
            : base(next, options?.Value, new IpRateLimitProcessor(options?.Value, counterStore, policyStore, config), config)

        {
            _logger        = logger;
            _ipParser      = ipParser != null ? ipParser : new ReversProxyIpParser(_options.RealIpHeader);
            _ipPolicyStore = policyStore;

            _processor = new IpRateLimitProcessor(_options, counterStore, policyStore, _ipParser);
        }
 public CustomIpRateLimitMiddleware(
     IMemoryCache memoryCache,
     IBlockIpService blockIpService,
     RequestDelegate next,
     IOptions <IpRateLimitOptions> options,
     IRateLimitCounterStore counterStore,
     IIpPolicyStore policyStore,
     ILogger <IpRateLimitMiddleware> logger,
     IIpAddressParser ipParser = null)
     : base(next, options, counterStore, policyStore, logger, ipParser)
 {
     _memoryCache    = memoryCache;
     _blockIpService = blockIpService;
     _options        = options.Value;
     _logger         = logger;
 }
 public CustomIpRateLimitMiddleware(
     IMemoryCache memoryCache,
     IBlockIpService blockIpService,
     RequestDelegate next,
     IOptions<IpRateLimitOptions> options,
     IRateLimitCounterStore counterStore,
     IIpPolicyStore policyStore,
     ILogger<IpRateLimitMiddleware> logger,
     IIpAddressParser ipParser = null)
     : base(next, options, counterStore, policyStore, logger, ipParser)
 {
     _memoryCache = memoryCache;
     _blockIpService = blockIpService;
     _options = options.Value;
     _logger = logger;
 }
 public ClientRateLimitMiddleware(RequestDelegate next,
     IOptions<ClientRateLimitOptions> options,
     IRateLimitCounterStore counterStore,
     IClientPolicyStore policyStore,
     IClientRequestStore clientRequestStore,
     IClientRateLimitProcessor clientRateLimitProcessor,
     ILogger<ClientRateLimitMiddleware> logger
     )
 {
     _next = next;
     _options = options.Value;
     _clientRequestStore = clientRequestStore;
     _logger = logger;
     _processor = clientRateLimitProcessor;
    // _processor = new ClientRateLimitProcessor(_options, counterStore, policyStore);
 }