WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

os/ratelimiter

Repository files navigation

Rate Limiter

A generic rate limiter implementation in Go.

Design

There are a few main concepts:

  • Identifier: Provides a way to identify the request (e.g. IPIdentifier, TokenIdentifier)
  • Store: Stores the counter (e.g. MemoryStore, FileStore, RedisStore)
  • Limiter: Decides if a call is allowed (e.g. FixedWindowLimiter, SlidingWindowLog)

I've used Fixed Window Counter algorithm for this implementation as it's space efficient and easy to implement.

Requirements

Running

In Docker

make run

Locally

make run-local

Testing

In Docker

make test

Locally

make test-local

About

A generic rate limiter implementation in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published