Redis-rate-limiter - An abstraction over redist rate/v9 package

RATE_LIMIT_POC

Notes

  • This POC is based on github.com/go-redis/redis_rate/v9 package for rate limiting, which internally implements Leaky Bucket rate algorithm.

  • This package relies on a Redis instance for persisting rate limiting specific information. This POC assumes that there is a Redis instance running on your machine at PORT=6379.

  • This POC demonstrates both middleware based and standalone function based implementations for rate limiting.

  • There are 3 endpoints being served from the server:

Endpoint 1

  • POST /auth - This POST endpoint is a simulation of an authentication endpoint where user will provide their Identification Type(passport/nationalid/taxid) and the value of that identification in the request body as JSON.

      Success response also writes a cookie on the client named - `session_id` which has a `MaxAge` of 60 secs.
    

Request

    {
        "type": "passport",
        "value": "XXXXXXX"
    }

Response 1 - Success

Authentication successful

Response 1 - Exceeded Rate Limit quota

Too Many Requests

Endpoint 2

  • GET /otp - This GET endpoint is a simulation of when we identified customer in Nana database and now we need to send an OTP for them to validate.
    This API requires session_id cookie to be present on client, hence /auth endpoint needs to be invoked first

Response 1 - Success 200 OK

Here is your new OTP: <new/existing otp>

Response 2 - 400 Bad Request

no session_id cookie received

Response 3 - 429 Too many requests

Too Many Requests
Owner
Similar Resources

Gcra - Package gcra implements the generic cell rate algorithm

gcra Package gcra implements the generic cell rate algorithm (GCRA). Example opt

Jan 23, 2022

Ratelimit - This package provides a Golang implementation of the leaky-bucket rate limit algorithm

Go rate limiter This package provides a Golang implementation of the leaky-bucke

Jul 26, 2022

Golang implementation of Sliding Window Algorithm for distributed rate limiting.

Golang implementation of Sliding Window Algorithm for distributed rate limiting.

slidingwindow Golang implementation of Sliding Window Algorithm for distributed rate limiting. Installation $ go get -u github.com/RussellLuo/slidingw

Dec 27, 2022

HTTP rate limiting module for Caddy 2

This module implements both internal and distributed HTTP rate limiting. Requests can be rejected after a specified rate limit is hit.

Jan 3, 2023

Light weight http rate limiting proxy

Introduction Light weight http rate limiting proxy. The proxy will perform rate limiting based on the rules defined in the configuration file. If no r

Dec 23, 2022

A little ping pong service that implements rate limiting with golang

Fred the Guardian Introduction Writing a little ping pong service that implements rate limiting with the programming language golang. Requirements Web

Jan 2, 2022

A Caddy v2 extension to apply rate-limiting for HTTP requests

ratelimit A Caddy v2 extension to apply rate-limiting for HTTP requests. Installation $ xcaddy build --with github.com/owlwang/caddy-ratelimit Caddyfi

Jan 28, 2022

Dhrate - Quickly check Dockerhub rate (limit) as an unauthenticated user

Dhrate - Quickly check Dockerhub rate (limit) as an unauthenticated user

Dockerhub Rate A small Go program that returns the Dockerhub rate of an unauthen

Feb 7, 2022
A rate limiter for the gin framework

GinRateLimit GinRateLimit is a rate limiter for the gin framework. By default, it can only store rate limit info in memory. If you want to store it so

Dec 22, 2021
Common rate-limiter implementations

Overview An example Rate Limiter library used to control the rate that events occur, but these can also be used as thresholds that should replenish ov

Dec 1, 2021
A rate limiter for Golang, with ETCD data bindings

Go Rate limiter This package allows us to have a distributed rate limiter, using Redis as a central counter. The limits that are set are only "soft" l

Dec 9, 2021
Go rate limiter used to ensure a minimum duration between executions.

Ratelimiter Rate limiter used to ensure a minimum duration between executions. Additionally supports the optional limit of max queue size. This can be

Jul 14, 2022
Pacemaker - Rate limit library. Currently implemented rate limits are

PaceMaker Rate limit library. Currently implemented rate limits are Fixed window

Nov 5, 2022
The devs are over here at devzat, chat over SSH!

Devzat Where are the devs at? Devzat! Devzat is chat over SSH Try it out: ssh sshchat.hackclub.com Add this to ~/.ssh/config: Host chat HostName s

Jan 7, 2023
Um chat feito em go utilizando gorilla/websocket, go-redis/redis,golang-jwt/jwte labstack/echo.

go-chat Um chat feito em go utilizando gorilla/websocket, go-redis/redis,golang-jwt/jwte labstack/echo. Why Eu gostaria de aprender algumas ferramenta

Jul 14, 2022
Simple-request-limiter - Example of limiting API requests using standard Go library

Route: http://localhost:8080/urls example of body in POST request that was used:

Feb 2, 2022
Go library providing an abstraction to Ethereum execution nodes

go-execution-client Go library providing an abstraction to Ethereum execution nodes. Its external API follows the official Ethereum consensus APIs spe

Aug 12, 2022
A simple abstraction around ssh and sftp libraries in Go(Golang).

sshx A simple abstraction around ssh and sftp libraries in Go(Golang). Resources Installation Installation Install sshx as you normally would for any

Dec 14, 2022