{"id":16751199,"url":"https://github.com/shalzz/ambassador-rust-ratelimiter","last_synced_at":"2026-05-19T04:04:38.599Z","repository":{"id":69169378,"uuid":"229395351","full_name":"shalzz/ambassador-rust-ratelimiter","owner":"shalzz","description":"Rate Limiting service for Ambassador in Rust","archived":false,"fork":false,"pushed_at":"2020-08-14T16:48:16.000Z","size":46,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-22T17:13:20.808Z","etag":null,"topics":["ambassador","ambassador-gateway","envoy-proxy","envoyproxy","helm-chart","kubernetes","rate-limiter","ratelimiter","rust","rust-lang"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shalzz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-12-21T07:49:14.000Z","updated_at":"2021-01-19T00:06:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"896846c9-f1d1-4dc4-887e-8203cc2b2a6d","html_url":"https://github.com/shalzz/ambassador-rust-ratelimiter","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalzz%2Fambassador-rust-ratelimiter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalzz%2Fambassador-rust-ratelimiter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalzz%2Fambassador-rust-ratelimiter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shalzz%2Fambassador-rust-ratelimiter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shalzz","download_url":"https://codeload.github.com/shalzz/ambassador-rust-ratelimiter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826783,"owners_count":20354220,"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":["ambassador","ambassador-gateway","envoy-proxy","envoyproxy","helm-chart","kubernetes","rate-limiter","ratelimiter","rust","rust-lang"],"created_at":"2024-10-13T02:43:16.990Z","updated_at":"2026-05-19T04:04:33.538Z","avatar_url":"https://github.com/shalzz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Ambassador Rate Limiter in Rust\n\nThis is a rate limiter service written in Rust for [Datawires][0] [Ambassador][1],\na Cloud Native proxy/API Gateway.\n\n### Workings\n\nThis is based on the Leaky bucket algorithm and currently supports two plans\nwith different rate limits. The rate limits themselves as well as the number of\nplans can be tweaked for your own requirements.\n\n### Required Headers\n\nTo identify requests it expects two headers passed on from the authentication service\nthat ambassador forwards to our rate-limiter service as `RateLimitDescriptor` Entries.\n\nYour HTTP header names can be anything you want but when defining the Mapping\nCRD of ambassador for your service make sure the labels are the same as:\n\n* `xapiheader`: an API key used to uniquely identify an API user.\n* `xuserheader`: the \"plan\" the user of the API is currently on which defines the \n    extent of the rate limiting. This should be determined by your auth service\n    and added as an header to the request.\n\nNote:\n* `remote_address`: Remote IP address is used in-case your users need to use the\n    API from a client device.  In case you don't need this feature you change to\n    ratelimit on the bases of the `api_key` instead of the `remote_ip`.\n\nFor more details on how to setup the rate-limiting service see ambassador [docs][3]\n\nFor Example:\n```yml\napiVersion: ambassador/v1\nkind:  Mapping\nname: {{ template \"myservice.fullname\" . }}_mapping\nservice: {{ template \"myservice.fullname\" . }}:{{ .Values.service.port }}\nlabels:\n  ambassador:\n    - remote_address\n    - xapiheader:\n        header: \"x-api-key\"\n        omit_if_not_present: true\n    - xuserheader:\n        header: \"x-user-plan\"\n        omit_if_not_present: true\n```\n\n### Authentication Service setup\n\nIn order for Ambassador to pass on the required headers from the HTTP request to\nthe `RateLimitService` make sure you whitelist the headers in the `AuthService`\nservice defined your \"getambassador.io/config\" annotation when deploying the\ncore Ambassador service along with other ambassador specific services you might have.\nFor more details see the ambassador [docs][4] on authentication.\n\nFor Example:\n```yml\ngetambassador.io/config: |\n  apiVersion: ambassador/v1\n  kind:  AuthService\n  name:  authentication\n  auth_service: \"washed-sheep-ambassador-auth-service:3001\"\n  path_prefix: \"/extauth\"\n  allowed_request_headers:\n  - \"x-api-key\"\n  - \"x-api-secret\"\n  allowed_authorization_headers:\n  - \"x-api-key\"\n  - \"x-user-plan\"\n  ---\n```\n\n### Helm chart\n\nThis repo contains a [helm](helm.sh/) chart in the `helm` directory to help\ndeploy the service to your Kubernetes cluster.\n\n### Logging\n\nThis project uses the [`env_logger`][2] rust crate to control logging to the stdout.\n\nYou can specify the log level with the Environment variable \n`RUST_LOG` such as `RUST_LOG=ambassador_rust_rate_limiter=debug`.\n\n[0]: https://www.datawire.io/\n[1]: https://www.getambassador.io/\n[2]: https://crates.io/crates/env_logger\n[3]: https://www.getambassador.io/user-guide/rate-limiting-tutorial/\n[4]: https://www.getambassador.io/user-guide/auth-tutorial/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalzz%2Fambassador-rust-ratelimiter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshalzz%2Fambassador-rust-ratelimiter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshalzz%2Fambassador-rust-ratelimiter/lists"}