Giter Club home page Giter Club logo

golim's Introduction

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

export REDIS_URI=redis://localhost:6379
  • install golim

go install github.com/khalil-farashiani/golim@latest
  • initial golim limiter

golim init -n <limiter id> -d <destination address without scheme like google.com or 8.8.8.8>
  • add a role to specific limiter

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

golim remove -i <role id>
  • list all role from specific limiter

golim get -l
  • remove a limiter

golim removel -l <limiter id>
  • remove a role

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

TODO features

  • add default limiter
  • add regex
  • add ui version
  • make service open failed

golim's People

Contributors

khalil-farashiani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

golim's Issues

add regex

we need to add regex to specify one role for some endpoints

for example
users/*

we can add a role for all endpoints like users/single, users/posts etc with this pattern

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.