Adding RateLimit Feature ...
This commit is contained in:
@@ -2,6 +2,7 @@ namespace xCommons.Constants {
|
||||
public partial struct ConfigurationNodeNames {
|
||||
public const string CERTIFICATES_NODE = "Certificates";
|
||||
public const string SWAGGER_NODE = "SwaggerConfiguration";
|
||||
public const string RATE_LIMIT_NODE = "RateLimitConfiguration";
|
||||
public const string FILE_TYPE_DETECTOR_NODE = "FileTypeDetectorConfiguration";
|
||||
public const string MESSAGE_RESOURCE_TITLES_NODE = "MessageResourceTitles";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
namespace xCommons.Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// RateLimit Implementation Constants ...
|
||||
/// </summary>
|
||||
public partial struct XRateLimitConstants
|
||||
{
|
||||
public const string CacheKeyPrefix = "xratelimit";
|
||||
public const string ClientIdHeader = "X-ClientId";
|
||||
public const string RetryAfterHeader = "Retry-After";
|
||||
public const string LimitHeader = "X-RateLimit-Limit";
|
||||
public const string ResetHeader = "X-RateLimit-Reset";
|
||||
public const string AppliedItemKey = "X-RateLimit-Applied";
|
||||
public const string RemainingHeader = "X-RateLimit-Remaining";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using xExceptions.Attributes;
|
||||
|
||||
namespace xCommons.Constants
|
||||
{
|
||||
/// <summary>
|
||||
/// RateLimiting Modes ...
|
||||
/// </summary>
|
||||
public enum XRateLimitKeyMode
|
||||
{
|
||||
[StringValue("Ip")]
|
||||
Ip = 0,
|
||||
|
||||
[StringValue("ClientId")]
|
||||
ClientId = 1,
|
||||
|
||||
[StringValue("User")]
|
||||
User = 2,
|
||||
|
||||
[StringValue("Route")]
|
||||
Route = 3,
|
||||
|
||||
[StringValue("Custom")]
|
||||
Custom = 4
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user