public RedisProcessingStrategy(IConnectionMultiplexer connectionMultiplexer, IRateLimitConfiguration config, ILogger <RedisProcessingStrategy> logger) : base(config) { _connectionMultiplexer = connectionMultiplexer ?? throw new ArgumentException("IConnectionMultiplexer was null. Ensure StackExchange.Redis was successfully registered"); _config = config; _logger = logger; }
protected RateLimitMiddleware(RequestDelegate next, RateLimitOptions options, TProcessor processor, IRateLimitConfiguration config) { _next = next; _options = options; _processor = processor; _config = config; _config.RegisterResolvers(); }
public ClientRateLimitProcessor( ClientRateLimitOptions options, ICacheManager cacheManager, IRateLimitConfiguration config) : base(cacheManager, options, new ClientCounterKeyBuilder(), config) { _options = options; }
public ClientRateLimitMiddleware(RequestDelegate next, IOptions <ClientRateLimitOptions> options, ICacheManager cacheManager, IRateLimitConfiguration config, ILogger <ClientRateLimitMiddleware> logger) : base(next, options?.Value, new ClientRateLimitProcessor(options?.Value, cacheManager, config), config) { _logger = logger; }
public MyIpRateLimitMiddleware(RequestDelegate next , IOptions <IpRateLimitOptions> options , IRateLimitCounterStore counterStore , IIpPolicyStore policyStore , IRateLimitConfiguration config , ILogger <IpRateLimitMiddleware> logger) : base(next, options, counterStore, policyStore, config, logger) { }
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; }
public ClientRateLimitProcessor( ClientRateLimitOptions options, IRateLimitCounterStore counterStore, IClientPolicyStore policyStore, IRateLimitConfiguration config) : base(options, counterStore, new ClientCounterKeyBuilder(options), config) { _options = options; _policyStore = policyStore; }
public IpRateLimitProcessor( IpRateLimitOptions options, IRateLimitCounterStore counterStore, IIpPolicyStore policyStore, IRateLimitConfiguration config) : base(options, counterStore, new IpCounterKeyBuilder(options), config) { _options = options; _policyStore = policyStore; }
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; }
protected RateLimitProcessor( ICacheManager cacheManager, RateLimitOptions options, ICounterKeyBuilder counterKeyBuilder, IRateLimitConfiguration config) { _cacheManager = cacheManager; _options = options; _counterKeyBuilder = counterKeyBuilder; _config = config; }
public IpRateLimitMiddleware(RequestDelegate next, IProcessingStrategy processingStrategy, IOptions <IpRateLimitOptions> options, IIpPolicyStore policyStore, IRateLimitConfiguration config, ILogger <IpRateLimitMiddleware> logger ) : base(next, options?.Value, new IpRateLimitProcessor(options?.Value, policyStore, processingStrategy), config) { _logger = logger; }
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; }
protected RateLimitProcessor( RateLimitOptions options, IRateLimitCounterStore counterStore, ICounterKeyBuilder counterKeyBuilder, IRateLimitConfiguration config) { _options = options; _counterStore = counterStore; _counterKeyBuilder = counterKeyBuilder; _config = config; }
public IpRateLimitProcessor( IpRateLimitOptions options, IRateLimitCounterStore counterStore, IIpPolicyStore policyStore, IRateLimitConfiguration config, IProcessingStrategy processingStrategy) : base(options) { _options = options; _policyStore = policyStore; _counterKeyBuilder = new IpCounterKeyBuilder(options); _processingStrategy = processingStrategy; }
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( IDistributedCache distributedCache, IBlockIpService blockIpService, RequestDelegate next, IProcessingStrategy processingStrategy, IRateLimitConfiguration rateLimitConfiguration, IOptions <IpRateLimitOptions> options, IIpPolicyStore policyStore, ILogger <CustomIpRateLimitMiddleware> logger) : base(next, processingStrategy, options, policyStore, rateLimitConfiguration, logger) { _distributedCache = distributedCache; _blockIpService = blockIpService; _options = options.Value; _logger = logger; }
/// <summary> /// Initializes a new instance of the <see cref="ThrottleMiddleware"/> class. /// </summary> /// <param name="next">The next.</param> /// <param name="options">The options.</param> /// <param name="counterStore">The counter store.</param> /// <param name="policyStore">The policy store.</param> /// <param name="config">The rate limit configuration.</param> /// <param name="logger">The logger.</param> /// <param name="configuration">The API configuration.</param> /// <param name="serializer">The JSON serializer.</param> /// <exception cref="ArgumentNullException">configuration</exception> public ThrottleMiddleware( RequestDelegate next, IOptions <IpRateLimitOptions> options, IRateLimitCounterStore counterStore, IIpPolicyStore policyStore, IRateLimitConfiguration config, ILogger <IpRateLimitMiddleware> logger, IApiConfiguration configuration, IDefaultJsonSerializer serializer) : base(next, options, counterStore, policyStore, config, logger) { Ensure.ArgumentNotNull(options, nameof(options)); if (options.Value == null) { throw new UnexpectedNullException("The options value is null."); } this.options = options.Value; this.configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); this.serializer = serializer ?? throw new ArgumentNullException(nameof(serializer)); }
public IpRateLimitMiddleware(RequestDelegate next, IProcessingStrategy processingStrategy, Microsoft.Extensions.Options.IOptions <IpRateLimitOptions> options, IRateLimitCounterStore counterStore, IIpPolicyStore policyStore, IRateLimitConfiguration config, ILogger <IpRateLimitMiddleware> logger) : base(next, (RateLimitOptions)(options?.Value), new IpRateLimitProcessor(options?.Value, counterStore, policyStore, config, processingStrategy), config) { _logger = logger; }
protected ProcessingStrategy(IRateLimitConfiguration config) { _config = config; }
public AsyncKeyLockProcessingStrategy(IRateLimitCounterStore counterStore, IRateLimitConfiguration config) : base(config) { _counterStore = counterStore; _config = config; }