Skip to main content

Crate hyperlane_plugin_rate_limit

Crate hyperlane_plugin_rate_limit 

Source
Expand description

hyperlane-plugin-rate-limit

64-way sharded lock-free atomic GCRA and fixed-window rate limiter plugin for Hyperlane with extensible KeyExtractor and RateLimitStore traits and RFC RateLimit-* response headers.

Structs§

ClientIpKeyExtractor
Built-in KeyExtractor partitioning traffic by client IP address.
HeaderKeyExtractor
Built-in KeyExtractor partitioning traffic by a specific request header value (for example X-Api-Key).
PathAndIpKeyExtractor
Built-in KeyExtractor partitioning traffic by (request_path, client_ip).
RateLimitDecision
Result of evaluating one request against a RateLimitStore.
RateLimitHook
Opt-in ServerHook enforcing configured rate limits and attaching RFC RateLimit-* headers.
RateLimitPlugin
Process-wide RateLimitPlugin registry storing policy, RateLimitStore, and KeyExtractor.
RateLimitPolicy
Configuration policy governing ShardedRateLimiter and RateLimitPlugin.
ShardedRateLimiter
High-concurrency 64-way sharded lock-free in-memory RateLimitStore.

Enums§

RateLimitAlgorithm
Rate-limiting algorithm used by crate::ShardedRateLimiter.

Constants§

DEFAULT_RATE_LIMIT_BURST
Default burst capacity when not overridden.
DEFAULT_RATE_LIMIT_MAX_KEYS
Default maximum tracked distinct rate-limit keys across all shards.
DEFAULT_RATE_LIMIT_REQUESTS
Default maximum requests permitted per window.
DEFAULT_RATE_LIMIT_WINDOW_MS
Default rate-limit window duration in milliseconds (60 seconds).
HEADER_RATE_LIMIT_LIMIT
Standard RateLimit-Limit response header name.
HEADER_RATE_LIMIT_REMAINING
Standard RateLimit-Remaining response header name.
HEADER_RATE_LIMIT_RESET
Standard RateLimit-Reset response header name (seconds until window/burst reset).

Traits§

KeyExtractor
Extracts the rate-limiting partition key (for example client IP, API key, or user + route).
RateLimitStore
Pluggable rate-limit decision backend (in-memory sharded or external distributed store).