Structin erlfastly 0.13.1View source
pub struct ERL { /* private fields */ }

An edge rate limiter which includes a ratecounter and a penaltybox.

Methods

check_rate

View source
fn check_rate(&self, entry: &str, delta: u32, window: RateWindow, limit: u32, ttl: Duration) -> Result<bool, ERLError>

Increment an entry in a rate counter and check if the client has exceeded some average number of requests per second (RPS) over the window. If the client is over the rps limit for the window, add to the penaltybox for ttl. Valid ttl span is 1m to 1h and TTL value is truncated to the nearest minute.

Parameters

self: &Self
entry: &str
delta: u32
window: RateWindow
limit: u32
ttl: Duration

Returns

fn open(ratecounter: RateCounter, penaltybox: Penaltybox) -> Self

Open a ERL with the given ratecounter and penaltybox.

Parameters

ratecounter: RateCounter
penaltybox: Penaltybox

Returns

Self

Auto trait implementations

Blanket implementations