hyperlane-plugin-rate-limit 23.3.2

A 64-way sharded lock-free atomic GCRA and fixed-window rate limiter plugin for the Hyperlane framework with extensible KeyExtractor and RateLimitStore traits and RFC RateLimit headers.
Documentation
<div align="center">

<img src="https://devhub.vip/pages/docs/img/hyperlane.png" alt="hyperlane-plugin-rate-limit logo" height="120">

# hyperlane-plugin-rate-limit

**64-Shard Lock-Free Atomic GCRA & Fixed-Window Rate Limiter Plugin**

[![Crates.io Version](https://flat.badgen.net/crates/v/hyperlane-plugin-rate-limit)](https://crates.io/crates/hyperlane-plugin-rate-limit)
[![Docs.rs](https://img.shields.io/docsrs/hyperlane-plugin-rate-limit?style=flat-square)](https://docs.rs/hyperlane-plugin-rate-limit)
[![CI Status](https://img.shields.io/github/actions/workflow/status/hyperlane-dev/hyperlane/rust.yml?branch=master&style=flat-square&label=CI)](https://github.com/hyperlane-dev/hyperlane/actions/workflows/rust.yml)
[![Rust 2024](https://img.shields.io/badge/edition-2024-orange.svg?style=flat-square)](https://www.rust-lang.org)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](../../LICENSE)

[Workspace Overview](../../README.md) · [Plugin Catalog](../README.md) · [API Docs](https://docs.rs/hyperlane-plugin-rate-limit/latest/)

</div>

---

## Overview

`hyperlane-plugin-rate-limit` enforces high-concurrency per-client and per-route request quotas for [`hyperlane`](../../README.md) services (hook order `-95`). It is opt-in and transparent (`Status::Continue`) when unconfigured.

## Installation

```sh
cargo add hyperlane-plugin-rate-limit
```

## Usage

```rust
use hyperlane_plugin_rate_limit::{RateLimitPlugin, RateLimitPolicy};

fn setup_rate_limit() {
    RateLimitPlugin::init(RateLimitPolicy::default());
}
```

## Verification

```sh
cargo run -p hyperlane-cli -- fmt --check
cargo clippy -p hyperlane-plugin-rate-limit --all-features --all-targets -- -D warnings
cargo test -p hyperlane-plugin-rate-limit --all-features
```

## License

This project is licensed under the MIT License. See the [LICENSE](../../LICENSE) file for details.

## Contact

For inquiries, please contact the author at [root@devhub.vip](mailto:root@devhub.vip).