diff --git a/.idea/.idea.WebApiThrottle/.idea/.gitignore b/.idea/.idea.WebApiThrottle/.idea/.gitignore
new file mode 100644
index 0000000..1c4d16c
--- /dev/null
+++ b/.idea/.idea.WebApiThrottle/.idea/.gitignore
@@ -0,0 +1,13 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Rider ignored files
+/modules.xml
+/projectSettingsUpdater.xml
+/.idea.WebApiThrottle.iml
+/contentModel.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/.idea.WebApiThrottle/.idea/indexLayout.xml b/.idea/.idea.WebApiThrottle/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/.idea/.idea.WebApiThrottle/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/.idea.WebApiThrottle/.idea/vcs.xml b/.idea/.idea.WebApiThrottle/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/.idea.WebApiThrottle/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/config/applicationhost.config b/.idea/config/applicationhost.config
new file mode 100644
index 0000000..1e6cef3
--- /dev/null
+++ b/.idea/config/applicationhost.config
@@ -0,0 +1,970 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
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+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebApiThrottle/ThrottlingCore.cs b/WebApiThrottle/ThrottlingCore.cs
index a179792..8b25ddd 100644
--- a/WebApiThrottle/ThrottlingCore.cs
+++ b/WebApiThrottle/ThrottlingCore.cs
@@ -11,7 +11,7 @@ namespace WebApiThrottle
///
/// Common code shared between ThrottlingHandler and ThrottlingFilter
///
- internal class ThrottlingCore
+ public class ThrottlingCore
{
public ThrottlingCore()
{
@@ -20,28 +20,28 @@ public ThrottlingCore()
private static readonly object ProcessLocker = new object();
- internal ThrottlePolicy Policy { get; set; }
+ public ThrottlePolicy Policy { get; set; }
- internal IThrottleRepository Repository { get; set; }
+ public IThrottleRepository Repository { get; set; }
- internal IIpAddressParser IpAddressParser { get; set; }
+ public IIpAddressParser IpAddressParser { get; set; }
- internal bool ContainsIp(List ipRules, string clientIp)
+ public bool ContainsIp(List ipRules, string clientIp)
{
return IpAddressParser.ContainsIp(ipRules, clientIp);
}
- internal bool ContainsIp(List ipRules, string clientIp, out string rule)
+ public bool ContainsIp(List ipRules, string clientIp, out string rule)
{
return IpAddressParser.ContainsIp(ipRules, clientIp, out rule);
}
- internal IPAddress GetClientIp(HttpRequestMessage request)
+ public IPAddress GetClientIp(HttpRequestMessage request)
{
return IpAddressParser.GetClientIp(request);
}
- internal ThrottleLogEntry ComputeLogEntry(string requestId, RequestIdentity identity, ThrottleCounter throttleCounter, string rateLimitPeriod, long rateLimit, HttpRequestMessage request)
+ public ThrottleLogEntry ComputeLogEntry(string requestId, RequestIdentity identity, ThrottleCounter throttleCounter, string rateLimitPeriod, long rateLimit, HttpRequestMessage request)
{
return new ThrottleLogEntry
{
@@ -58,7 +58,7 @@ internal ThrottleLogEntry ComputeLogEntry(string requestId, RequestIdentity iden
};
}
- internal string RetryAfterFrom(DateTime timestamp, RateLimitPeriod period)
+ public string RetryAfterFrom(DateTime timestamp, RateLimitPeriod period)
{
var secondsPast = Convert.ToInt32((DateTime.UtcNow - timestamp).TotalSeconds);
var retryAfter = 1;
@@ -81,7 +81,7 @@ internal string RetryAfterFrom(DateTime timestamp, RateLimitPeriod period)
return retryAfter.ToString(System.Globalization.CultureInfo.InvariantCulture);
}
- internal bool IsWhitelisted(RequestIdentity requestIdentity)
+ public bool IsWhitelisted(RequestIdentity requestIdentity)
{
if (requestIdentity.ForceWhiteList)
{
@@ -116,7 +116,7 @@ internal bool IsWhitelisted(RequestIdentity requestIdentity)
return false;
}
- internal string ComputeThrottleKey(RequestIdentity requestIdentity, RateLimitPeriod period)
+ public string ComputeThrottleKey(RequestIdentity requestIdentity, RateLimitPeriod period)
{
var keyValues = new List()
{
@@ -154,7 +154,7 @@ internal string ComputeThrottleKey(RequestIdentity requestIdentity, RateLimitPer
return hex;
}
- internal List> RatesWithDefaults(List> defRates)
+ public List> RatesWithDefaults(List> defRates)
{
if (!defRates.Any(x => x.Key == RateLimitPeriod.Second))
{
@@ -184,7 +184,7 @@ internal List> RatesWithDefaults(List