Skip to content

Commit

Permalink
📚 update main readme
Browse files Browse the repository at this point in the history
  • Loading branch information
khalil-farashiani committed Apr 4, 2024
1 parent 5ba7e99 commit 87448d5
Showing 1 changed file with 59 additions and 12 deletions.
71 changes: 59 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

## Golim is rate golim based on token bucket algorithm

`Golim` is a rate 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, the timeout duration, etc.
`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 existing web service, as it only requires a few lines of code and minimal dependencies.
`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
Expand All @@ -13,13 +13,60 @@ all dependencies automatically resolve
- ff cli
- robfig-cron

## TODO (Golim v0.0.1):
- [x] initial the project
- [x] add db configuration
- [x] add roles logic to project
- [x] implement bucket algorithm
- [ ] make golim thread safe
- [x] add cli version
- [ ] add tests
- [x] add redis
- [ ] add default limiter, regex, ui version, make service open failed and ... (V1)
### 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 <limiter id> -d <destination address without scheme like google.com or 8.8.8.8>
```

- #### add a role to specific limiter
```bash
golim add -l <limiter id> -e <endpoint address like this /users/> -b <bucket size> -a <add token rate per minute> -i <initial token>
```

- #### remove a role from specific limiter
```bash
golim remove -i <role id>
```

- #### list all role from specific limiter
```bash
golim get -l
```

- #### remove a limiter
```bash
golim removel -l <limiter id>
```
- #### remove a role
```bash
golim remove -i <role id>
```

``all flags have alternative``
- -n <kbd>→</kbd> --name
- -p <kbd>→</kbd> --port
- -l <kbd>→</kbd> --limiter
- -n <kbd>→</kbd> --name
- -d <kbd>→</kbd> --destination
- -e <kbd>→</kbd> --endpoint
- -b <kbd>→</kbd> --bsize
- -a <kbd>→</kbd> --add_token
- -i <kbd>→</kbd> --initial_token

## TODO features
- [ ] add default limiter
- [ ] add regex
- [ ] add ui version
- [ ] make service open failed

0 comments on commit 87448d5

Please sign in to comment.