Golim
is a rate limiter, Golim
program written in Go that allows you to control the frequency and concurrency of requests to your web service. It uses a token bucket algorithm to regulate the incoming traffic and prevent overload or abuse. You can customize the parameters of Golim
to suit your needs, such as the bucket size, the refill rate, endpoint customization, etc.
Golim
is useful for web developers who want to protect their web service from excessive or malicious requests, while ensuring a fair and smooth user experience. Golim is also easy to use and integrate with your web service with any language like C#, PHP, JS, Python, Golang etc. as it only requires a minimal dependencies.
all dependencies automatically resolve
- sqlc (as query builder)
- redis-go
- ff cli
- robfig-cron
first of all export redis server address with
export REDIS_URI=redis://localhost:6379
go install github.com/khalil-farashiani/golim@latest
golim init -n <limiter id> -d <destination address without scheme like google.com or 8.8.8.8>
golim add -l <limiter id> -e <endpoint address like this /users/> -b <bucket size> -a <add token rate per minute> -i <initial token>
golim remove -i <role id>
golim get -l
golim removel -l <limiter id>
golim remove -i <role id>
all flags have alternative
- -n → --name
- -p → --port
- -l → --limiter
- -n → --name
- -d → --destination
- -e → --endpoint
- -b → --bsize
- -a → --add_token
- -i → --initial_token
- add default limiter
- add regex
- add ui version
- make service open failed