RateLimiter class

RateLimiter class for rate limiting requests

Constructors

RateLimiter({required String storagePath, required int maxRequests, required Duration resetDuration, required String encryptionPassword, required IPBlocker ipBlocker, required bool shouldDisplayCaptcha})
Constructor

Properties

encryptionPassword → String
Encryption Key for IPs
final
hashCode → int
The hash code for this object.
no setterinherited
ipBlocker → IPBlocker
IP Blocker instance
final
maxRequests → int
Max requests
final
resetDuration → Duration
Reset duration
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
shouldDisplayCaptcha → bool
Specifies if the captcha should be displayed when the rate limit is exceeded
final
storagePath → String
File for IPs
final

Methods

isRateLimited(String clientIp) → Future<bool>
Checks if the client IP address is rate-limited.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refresh() → Future<void>
Refreshes the rate limiter by saving the current request data to storage.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited