Rate limit middleware for poem web framework

Overview

Rate limit middleware for Poem framework

Usage

Check examples, poem-ratelimit is available on crates.io.

A yaml configuration file is used to set limit for global service, per IP and route:

global:
  # Global limit for all connections
  max_requests: 20
  # Seconds to refresh limit, we allow 20req/30s here
  time_window: 30
ip:
  # QPS limit for a single client IP
  max_requests: 10
  time_window: 30
route:
  /:
    # QPS limit for a single route
    max_requests: 5
    time_window: 30

How it works

For every requests, we use sliding window algorithm to check if the request is processable. Sorted lists with key like IP, route is stored in Redis. You can check the lua script in lib.rs.

License

poem-ratelimit is licensed under Apache-2.0.

You might also like...
Web-wrapped Supabase desktop app for macOS, Windows & Linux powered by Tauri
Web-wrapped Supabase desktop app for macOS, Windows & Linux powered by Tauri

Supabase Desktop App What is it? It's a cross-platform web-wrapped Supabase desktop app powered by Tauri. You can install it on your macOS, Windows (u

Framework is a detector for different frameworks in one projects

Framework is a detector for different frameworks in one projects Usage use

Minimal, flexible framework for implementing solutions to Advent of Code in Rust

This is advent_of_code_traits, a minimal, flexible framework for implementing solutions to Advent of Code in Rust.

A new comfortable back end framework for rustaceans.

Black Tea is a new Rust back end framework based on hyper. We are enthusiastic to provide developers some enhanced features and comfortable coding experience.

A framework for iterating over collections of types implementing a trait without virtual dispatch
A framework for iterating over collections of types implementing a trait without virtual dispatch

zero_v Zero_V is an experiment in defining behavior over collections of objects implementing some trait without dynamic polymorphism.

Doku is a framework for building documentation with code-as-data methodology in mind.
Doku is a framework for building documentation with code-as-data methodology in mind.

Doku is a framework for building documentation with code-as-data methodology in mind. Say goodbye to stale, hand-written documentation - with D

Another Async IO Framework based on io_uring

kbio, the Async IO Framework based on io_uring, is used in KuiBaDB to implement async io. Features Support multi-threading concurrent task submission.

Better error messages for axum framework.

axum-debug This is a debugging crate that provides better error messages for axum framework. axum is a great framework for developing web applications

Rust implementation of the Edge IoT framework

A Rust-based implementation of Edge-rs for the Raspberry Pi Pico Getting started For more details see the following article on getting started for get

Owner
Rui Li
At least, we are free when we create things.
Rui Li
OpenAPI support for Poem

Poem OpenAPI Fast and Type-Safe OpenAPI implementation for Poem. Poem-openapi allows you to easily implement APIs that comply with the OpenAPIv3 speci

Poem Web 40 Sep 16, 2021
An Ethers middleware for submitting Flashbots bundles

Ethers Flashbots An Ethers middleware to send transactions as Flashbots bundles. Installation Add ethers-flashbots to your Cargo.toml. # This is the d

Oliver Nordbjerg 267 Jan 4, 2023
A tool to run web applications on AWS Lambda without changing code.

AWS Lambda Adapter A tool to run web applications on AWS Lambda without changing code. How does it work? AWS Lambda Adapter supports AWS Lambda functi

AWS Samples 321 Jan 2, 2023
Dr-dotnet - 🩺 One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service

Dr-dotnet - ?? One-click diagnosis of your dotnet applications. Works both locally or remotely as a web service. Based on the lowest level dotnet profiling APIs and using the rust language ?? for a minimal runtime penalty.

Olivier Giniaux 25 Dec 17, 2022
image url web-scrapper written in rust

imgs - CLI Webscrapper image url web-scrapper written in rust This is a cli application completely written in rust, it aim is to scrap image-url from

Michael Olayemi 1 Apr 2, 2022
Manage self-hosted Supabase instances with an easy to use API & Web Portal (soon)

SupaManager A project by Harry Bairstow; Manage self-hosted Supabase instances with an easy to use API & Web Portal (soon) ⚠️ Note: The project is in

Harry Bairstow 11 Sep 15, 2022
A simple web-app allowing you to batch archive groups of repositories from a given organization

ice-repos My goal here is to build a simple web-app allowing you to batch archive groups of repositories from a given organization, using Rust+Yew. As

Nic McPhee 6 Nov 5, 2022
A stupidly simple and easy to self-host, personal server for file hosting on the web

Grasswave CDN A stupidly simple and easy to self-host, personal server for file hosting on the web. Written in Rust. Thanks, @Maciejowski, for the sty

Rafał Baran 3 Jan 3, 2023
Nitrogen - a tool for deploying web services to AWS Nitro Enclaves

Nitrogen CLI Nitrogen is a tool for deploying web services to AWS Nitro Enclaves. Given a dockerfile and an ssh key, Nitrogen will spin up an EC2, con

Cape Privacy 57 Dec 26, 2022
A special web app to render fancy UTF-8 sequences. :hindu_temple: :scroll:

UTF RENDER ?? ?? A special web app to render fancy UTF-8 sequences. ?? ?? ABOUT ?? Emojis and fancy symbols are part of the UTF-8 character standard (

✭ ANGEL DOLLFACE ✭ 4 Jan 15, 2023