public IpRateLimitProcessor(IpRateLimitOptions options,
                                    IRateLimitCounterStore counterStore,
                                    IIpPolicyStore policyStore,
                                    IIpAddressParser ipParser)
        {
            _options      = options;
            _counterStore = counterStore;
            _policyStore  = policyStore;
            _ipParser     = ipParser;

            _core = new RateLimitCore(Processor.IpRateLimit, options, _counterStore);
        }
Пример #2
0
        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 != null ? ipParser : new ReversProxyIpParser(_options.RealIpHeader);

            _processor = new IpRateLimitProcessor(_options, counterStore, policyStore, _ipParser);
        }