{"id":17645545,"url":"https://github.com/sgaunet/ratelimiter","last_synced_at":"2025-03-30T07:15:22.502Z","repository":{"id":44246880,"uuid":"498078735","full_name":"sgaunet/ratelimiter","owner":"sgaunet","description":"Utility to put in front of a webservice to handle a ratelimit","archived":false,"fork":false,"pushed_at":"2024-09-15T19:13:45.000Z","size":26,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T09:19:02.066Z","etag":null,"topics":["http","ratelimit"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sgaunet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-30T19:51:21.000Z","updated_at":"2024-09-15T19:13:21.000Z","dependencies_parsed_at":"2024-06-21T08:42:29.987Z","dependency_job_id":"cc2ef094-bac1-46ec-98e9-d4398fbea3ea","html_url":"https://github.com/sgaunet/ratelimiter","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgaunet%2Fratelimiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgaunet%2Fratelimiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgaunet%2Fratelimiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sgaunet%2Fratelimiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sgaunet","download_url":"https://codeload.github.com/sgaunet/ratelimiter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285817,"owners_count":20752957,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["http","ratelimit"],"created_at":"2024-10-23T10:57:05.622Z","updated_at":"2025-03-30T07:15:22.481Z","avatar_url":"https://github.com/sgaunet.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/sgaunet/ratelimiter)](https://goreportcard.com/report/github.com/sgaunet/ratelimiter)\n[![GitHub release](https://img.shields.io/github/release/sgaunet/ratelimiter.svg)](https://github.com/sgaunet/ratelimiter/releases/latest)\n![GitHub Downloads](https://img.shields.io/github/downloads/sgaunet/ratelimiter/total)\n[![Maintainability](https://api.codeclimate.com/v1/badges/6a77e40e92008bab6661/maintainability)](https://codeclimate.com/github/sgaunet/ratelimiter/maintainability)\n[![License](https://img.shields.io/github/license/sgaunet/ratelimiter.svg)](LICENSE)\n\n# ratelimiter\n\nUtility to put in front of a webservice to handle a ratelimit. \n\nWorks :\n\n* with http protocol (websocket not tested)\n* ratelimit by IP (check X-FORWARDED-FOR header)\n\n## Configuration\n\nWith a configuration file :\n\n```\n---\nlogLevel: debug\nrateNumber: 1  \nrateDurationInSeconds: 1\ntagetService: http://localhost:8080\n# targetService: http://localhost:5678\ndaemonPort: 1337\n```\n\nOr environment variable :\n\n```\nRATELIMIT_TARGET\nRATELIMIT_DAEMONPORT\nRATELIMIT_LOGLEVEL\nRATELIMIT_NUMBER\nRATELIMIT_DURATIONINSECONDS\n```\n\n# Execution\n\nWith a docker-compose (change the latest to the latest version) :\n\n\n```\nversion: '3.2'\nservices:\n    echo:\n        image: sgaunet/http-echo:latest\n\n    ratelimiter:\n      image: sgaunet/ratelimiter:latest\n      ports:\n        - 1337:1337\n      environment:\n        - RATELIMIT_TARGET=http://echo:8080\n        - RATELIMIT_DAEMONPORT=1337\n        - RATELIMIT_LOGLEVEL=debug\n        - RATELIMIT_NUMBER=305\n        - RATELIMIT_DURATIONINSECONDS=10\n```\n\nOr with the single binary, option -c to specify a configuration file.\n\n**Please, do not use latest tag. I'm using it when developping so it could not work properly.**\n\n# Install as a systemd service\n\n```\ncurl -s https://raw.githubusercontent.com/sgaunet/ratelimiter/main/install.sh | sudo bash\n```\n\n**This script has been only tested on amd64 arch.**\n\n# Development\n\n## prerequisites\n\nThis project is using :\n\n* golang\n* [task for development](https://taskfile.dev/#/)\n* docker\n* [docker buildx](https://github.com/docker/buildx)\n* docker manifest\n* [goreleaser](https://goreleaser.com/)\n* [vegeta](https://github.com/tsenart/vegeta) : load testing tool\n* [pre-commit](https://pre-commit.com/)\n\nThere are hooks executed in the precommit stage. Once the project cloned on your disk, please install pre-commit:\n\n```\nbrew install pre-commit\n```\n\nInstall tools:\n\n```\ntask install-prereq\n```\n\nAnd install the hooks:\n\n```\ntask install-pre-commit\n```\n\nIf you like to launch manually the pre-commmit hook:\n\n```\ntask pre-commit\n```\n\n\n## tasks\n\n* compile\n\n```\ntask \n```\n\n* create docker image\n\n```\ntask image\n```\n\n* test release\n\n```\ntask snapshot\n```\n\n* create release\n\n```\ntask release\n```\n\n## load test\n\n### the binary\n\n```\ncd tst/local\ndocker-compose up -d    # launch the web server that will be behind the ratelimiter\n./launch-binary.sh      # execute the binary in front of the webserver\n```\n\nLaunch the load test with: task load-test\n\n## docker image (env var)\n\n```\ncd tst/config-env-vars\ndocker-compose up -d    # launch the web server and ratelimiter\n```\n\nLaunch the load test with: task load-test\n\n## docker image (configuration file)\n\n```\ncd tst/config-file\ndocker-compose up -d    # launch the web server and ratelimiter\n```\n\nLaunch the load test with: task load-test\n\n## Project Disclaimer\n\nThis software project is released under the MIT License and was created primarily for fun and testing purposes. While it may offer some interesting functionalities, please note:\n\n* Intended Use\n* This project is experimental in nature\n* It serves as a playground for ideas and concepts\n* The code may not be optimized or production-ready\n\n## Recommendation\n\nIf you find the features provided by this project useful or intriguing, we strongly recommend exploring more mature and established solutions for your actual needs. This project is not intended to compete with or replace professional-grade software in its domain.\n\n## Contributions\n\nWhile we appreciate your interest, please understand that this project may not be actively maintained or developed further. Feel free to fork and experiment with the code as per the MIT License terms.\nThank you for your understanding and enjoy exploring!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgaunet%2Fratelimiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsgaunet%2Fratelimiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsgaunet%2Fratelimiter/lists"}