No description
Find a file
2025-04-26 07:18:10 +03:00
.github Update test.yml 2025-04-26 07:18:10 +03:00
src update 2025-04-26 07:16:12 +03:00
tests update 2025-04-26 07:16:12 +03:00
.gitignore add github workflow 2022-05-12 14:09:19 +03:00
LICENSE Initial commit 2022-05-11 22:47:47 +03:00
limiter.nimble add github workflow 2022-05-12 14:09:19 +03:00
README.md update 2025-04-26 07:16:12 +03:00

Supranim Rate Limiter
A simple to use rate limiting library for web apps.
Provides an easy way to limit any action during a specific period of time.

Key features

  • Simple to use: Easy to integrate into your existing codebase.
import pkg/limiter

# Create a new rate limiter with a limit of 5 requests per minute
var rateLimiter = Limiter(
  maximumHits: 5'u,
  timeLimit: initDuration(seconds = 1),
  timeToWait: initDuration(seconds = 2)
)

# Simulate hits
for i in 0 ..< 5:
  if i < 5:
    assert rateLimiter.hit("127.0.0.1")
  else:
    assert not rateLimiter.hit("127.0.0.1")
sleep(3000)
assert rateLimiter.hit("127.0.0.1")

❤ Contributions & Support

🎩 License

MIT license. Made by Humans from OpenPeeps.
Copyright © 2025 OpenPeeps & Contributors — All rights reserved.