An open API service indexing awesome lists of open source software.

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.

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