https://github.com/khalil-farashiani/golim
Golim is a Go-based rate limiter using a token bucket algorithm to manage web service request rates with customizable settings.
https://github.com/khalil-farashiani/golim
bucket-al go golang limiter rate-limiter software token-bucket
Last synced: 3 months ago
JSON representation
Golim is a Go-based rate limiter using a token bucket algorithm to manage web service request rates with customizable settings.
- Host: GitHub
- URL: https://github.com/khalil-farashiani/golim
- Owner: khalil-farashiani
- License: mit
- Created: 2024-02-28T18:39:15.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-04-18T20:49:14.000Z (about 2 years ago)
- Last Synced: 2025-12-19T00:46:26.127Z (6 months ago)
- Topics: bucket-al, go, golang, limiter, rate-limiter, software, token-bucket
- Language: Go
- Homepage:
- Size: 82 KB
- Stars: 15
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golim
## Golim is rate golim based on token bucket algorithm
`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.
### Dependencies
all dependencies automatically resolve
- sqlc (as query builder)
- redis-go
- ff cli
- robfig-cron
### Usage
first of all export redis server address with
```bash
export REDIS_URI=redis://localhost:6379
```
- #### install golim
```bash
go install github.com/khalil-farashiani/golim@latest
```
- #### initial golim limiter
```bash
golim init -n -d
```
- #### add a role to specific limiter
```bash
golim add -l -e -b -a -i
```
- #### remove a role from specific limiter
```bash
golim remove -i
```
- #### list all role from specific limiter
```bash
golim get -l
```
- #### remove a limiter
```bash
golim removel -l
```
- #### remove a role
```bash
golim remove -i
```
``all flags have alternative``
- -n → --name
- -p → --port
- -l → --limiter
- -n → --name
- -d → --destination
- -e → --endpoint
- -b → --bsize
- -a → --add_token
- -i → --initial_token
## TODO features
- [ ] add default limiter
- [ ] add regex
- [ ] add ui version
- [ ] make service open failed