Simple-request-limiter - Example of limiting API requests using standard Go library

Similar Resources

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

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 pack

Feb 14, 2022

Application to shut down a machine using HTTP requests.

shutdownd Service to shut down a system using HTTP requests. Usage Here's a quick example of how you can use this software on Linux. Download or build

Nov 15, 2021

Gogrok is a self hosted, easy to use alternative to ngrok. It uses SSH as a base protocol, using channels and existing functionality to tunnel requests to an endpoint.

gogrok A simple, easy to use ngrok alternative (self hosted!) The server and client can also be easily embedded into your applications, see the 'serve

Dec 3, 2022

A standalone Web Server developed with the standard http library, suport reverse proxy & flexible configuration

A standalone Web Server developed with the standard http library, suport reverse proxy & flexible configuration

paddy 简介 paddy是一款单进程的独立运行的web server,基于golang的标准库net/http实现。 paddy提供以下功能: 直接配置http响应 目录文件服务器 proxy_pass代理 http反向代理 支持请求和响应插件 部署 编译 $ go build ./main/p

Oct 18, 2022

GopherTalk: a multi-user chat powered by GO to explore its standard library and features like sockets, goroutines, channels and sync package

GopherTalk: a multi-user chat powered by GO to explore its standard library and features like sockets, goroutines, channels and sync package

GopherTalk GopherTalk is a multi-user chat powered by GO to explore its standard

Jun 6, 2022

node api for proxying requests with golang to spoof tls fingerprint

WIP NOT BUILT WONT WORK AS IS gotTLS A node websocket api version of https://github.com/Carcraftz/TLS-Fingerprint-API to spoof TLS fingerprint to prev

Sep 28, 2021
Comments
  • Custom Request Limiter

    Custom Request Limiter

    Idea

    User will be able to write their own limiter function. Here is example to limit 100 request per IP for 10s

    reqIPLimiter := limiter.NewRequestLimitService(10*time.Second, 100, func(r *http.Request) string {
        return r.RemoteAddr
    })
    
    http.HandleFunc("/resources", reqIPLimiter.Limit(resourcesHandler))
    

    Another example is limit request by session id that stored in cookie:

    reqSessionLimiter := limiter.NewRequestLimitService(10*time.Second, 100, func(r *http.Request) string {
        return r.Cookie("Session-ID")
    })
    
    http.HandleFunc("/resources", reqIPLimiter.Limit(resourcesHandler))
    

    The default behavior (limit all request) can be achieved this way:

    reqIPLimiter := limiter.NewRequestLimitService(10*time.Second, 100, nil)
    
    http.HandleFunc("/resources", reqIPLimiter.Limit(resourcesHandler))
    

    And also user will be able to write their own response handler when current request is blocked

    limiter.OnTooManyRequest(func(w http.ResponseWriter, r *http.Request) {
        http.Error(w, "please try again later", http.StatusTooManyRequest)
    })
    
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
Request: a HTTP request library for Go with interfaces and mocks for unit tests

Requester Request is a HTTP request library for Go with interfaces and mocks for

Jan 10, 2022
A server that proxies requests and uses fhttp & my fork of CycleTLS to modify your clienthello and prevent your requests from being fingerprinted.

TLS-Fingerprint-API A server that proxies requests and uses my fork of CycleTLS & fhttp (fork of net/http) to prevent your requests from being fingerp

Jan 7, 2023
Go forward proxy with bandwidth limiting.
Go forward proxy with bandwidth limiting.

Goforward Go forward proxy with rate limiting. The code is based on Michał Łowicki's 100 LOC forward proxy. Download Releases can be downloaded from h

Nov 13, 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 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