Beispiel #1
0
        public Server()
        {
            Limiter = new IpRateLimiter(ip =>
            {
                var constraint = new CountByIntervalAwaitableConstraint(10, TimeSpan.FromSeconds(1));
                var constraint2 = new CountByIntervalAwaitableConstraint(35, TimeSpan.FromSeconds(10));

                // Compose the two constraints
                return TimeLimiter.Compose(constraint, constraint2);
            });
        }
Beispiel #2
0
 static IpRateLimiter()
 {
     Instance = new IpRateLimiter(DefaultLimiter());
 }