MCPcopy Index your code
hub / github.com/AaronErhardt/actix-governor

github.com/AaronErhardt/actix-governor @v0.10.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.10.0 ↗ · + Follow
106 symbols 293 edges 7 files 43 documented · 41% updated 3mo ago0.2.4 · 2021-01-07★ 1303 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

CI Docs crates.io

Actix Governor

A middleware for actix-web that provides rate-limiting backed by governor.

Features:

  • Simple to use
  • High customizability
  • High performance
  • Robust yet flexible API

Example

use actix_governor::{Governor, GovernorConfigBuilder};
use actix_web::{web, App, HttpServer, Responder};

async fn index() -> impl Responder {
    "Hello world!"
}

#[actix_web::main]
async fn main() -> std::io::Result<()> {
    // Allow bursts with up to five requests per IP address
    // and replenishes two elements per second
    let governor_conf = GovernorConfigBuilder::default()
        .requests_per_second(2)
        .burst_size(5)
        .finish()
        .unwrap();

    HttpServer::new(move || {
        App::new()
            // Enable Governor middleware
            .wrap(Governor::new(&governor_conf))
            // Route hello world service
            .route("/", web::get().to(index))
    })
    .bind("127.0.0.1:8080")?
    .run()
    .await
}

Add this to your Cargo.toml:

[dependencies]
actix-governor = "0.6"

Extension points exported contracts — how you extend this code

KeyExtractor (Interface)
Generic structure of what is needed to extract a rate-limiting key from an incoming request. ## Example ```rust use act [9 …
src/key_extractor.rs

Core symbols most depended-on inside this repo

burst_size
called by 18
src/lib.rs
finish
called by 17
src/lib.rs
clone
called by 15
src/lib.rs
call
called by 14
src/service.rs
seconds_per_request
called by 10
src/lib.rs
key_extractor
called by 9
src/lib.rs
milliseconds_per_request
called by 6
src/lib.rs
use_headers
called by 5
src/lib.rs

Shape

Method 69
Function 20
Class 15
Enum 1
Interface 1

Languages

Rust100%

Modules by API surface

src/lib.rs48 symbols
src/tests.rs21 symbols
src/key_extractor.rs16 symbols
examples/custom_key_bearer.rs7 symbols
examples/custom_key_ip.rs6 symbols
src/service.rs4 symbols
src/extractor.rs4 symbols

For agents

$ claude mcp add actix-governor \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page