Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 991d9e4

Browse files
committed
Added IP range rule example
1 parent a7686d3 commit 991d9e4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ config.MessageHandlers.Add(new ThrottlingHandler()
6868

6969
###IP and/or Client Key White-listing
7070

71-
If requests are initiated from a white-listed IP or Client, then the throttling policy will not be applied and the requests will not get stored.
71+
If requests are initiated from a white-listed IP or Client, then the throttling policy will not be applied and the requests will not get stored. The IP white-list supports IP v4 and v6 ranges like "192.168.0.0/24", "fe80::/10" and "192.168.0.0-192.168.0.255" for more information check [jsakamoto/ipaddressrange](https://github.com/jsakamoto/ipaddressrange).
7272

7373
``` cs
7474
config.MessageHandlers.Add(new ThrottlingHandler()
7575
{
7676
Policy = new ThrottlePolicy(perSecond: 2, perMinute: 60)
7777
{
7878
IpThrottling = true,
79-
IpWhitelist = new List<string> { "::1", "10.0.0.1" },
79+
IpWhitelist = new List<string> { "::1", "192.168.0.0/24" },
8080

8181
ClientThrottling = true,
8282
ClientWhitelist = new List<string> { "admin-key" }
@@ -97,8 +97,8 @@ config.MessageHandlers.Add(new ThrottlingHandler()
9797
IpThrottling = true,
9898
IpRules = new Dictionary<string, RateLimits>
9999
{
100-
{ "192.168.0.1", new RateLimits { PerSecond = 2 } },
101-
{ "192.168.1.2", new RateLimits { PerMinute = 30, PerHour = 30*60, PerDay = 30*60*24 } }
100+
{ "192.168.1.1", new RateLimits { PerSecond = 2 } },
101+
{ "192.168.2.0/24", new RateLimits { PerMinute = 30, PerHour = 30*60, PerDay = 30*60*24 } }
102102
},
103103

104104
ClientThrottling = true,

0 commit comments

Comments
 (0)