CheckIPRateLimit (open)
Implements rate limiting for the current request IP
Syntax
LOADLIB "mod::system/lib/services.whlib";
RECORD FUNCTION CheckIPRateLimit(RECORD criterium, INTEGER numhits, RECORD options)Parameters
RECORD criteriumA record describing this rate limit (hashed to generate a unique key)
INTEGER numhitsNumber of hits to accept in the time period
RECORD optionsOptions
BOOLEAN exemptdevExempt development servers from the ratelimit (if this is a request, add a header to indicate the rate was hit)
INTEGER timeperiodTime period to which the limit applies in ms. Defaults to 1 minute (60000)
Return value
RECORDLimit check result
BOOLEAN acceptedIf TRUE, accept this request, rate limit not hit
INTEGER backoffIf >0, recommended backoff time before requests will be accepted again (in ms)
Description
Wraps CheckRateLimit but automatically adds the current IP to the request. For ipv6, it will rate limit based on the /64 of the IP