{"id":15715413,"url":"https://github.com/cloudflare/rakelimit","last_synced_at":"2025-03-21T19:10:49.345Z","repository":{"id":50920959,"uuid":"286536542","full_name":"cloudflare/rakelimit","owner":"cloudflare","description":"A fair-share ratelimiter implemented in BPF","archived":false,"fork":false,"pushed_at":"2024-09-26T15:11:28.000Z","size":12499,"stargazers_count":189,"open_issues_count":7,"forks_count":11,"subscribers_count":18,"default_branch":"master","last_synced_at":"2024-10-08T12:48:37.129Z","etag":null,"topics":["bpf","dos-attack","linux","ratelimiter"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/cloudflare/rakelimit","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflare.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":"2020-08-10T17:19:23.000Z","updated_at":"2024-10-03T21:55:19.000Z","dependencies_parsed_at":"2022-08-28T10:11:33.463Z","dependency_job_id":"e2aec0df-4405-42bb-94b8-dc2effa28982","html_url":"https://github.com/cloudflare/rakelimit","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/cloudflare%2Frakelimit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Frakelimit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Frakelimit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflare%2Frakelimit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflare","download_url":"https://codeload.github.com/cloudflare/rakelimit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244852671,"owners_count":20521154,"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":["bpf","dos-attack","linux","ratelimiter"],"created_at":"2024-10-03T21:41:27.815Z","updated_at":"2025-03-21T19:10:49.324Z","avatar_url":"https://github.com/cloudflare.png","language":"C","funding_links":[],"categories":["Networking \u0026 Performance"],"sub_categories":["Traffic Analysis \u0026 Filtering"],"readme":"# Rakelimit\n\nA multi-dimensional fair-share rate limiter in BPF, designed for UDP.\nThe algorithm is based on Hierarchical Heavy Hitters, and ensures that no party can exceed\na certain rate of packets. For more information please take a look at our [blog post](https://blog.cloudflare.com/building-rakelimit/).\n\n## Usage\n\nTo activate rakelimit create a new instance and provide a file descriptor and a rate limit that you think the\nservice in question won't be able to handle anymore:\n\n```go\n\nconn, err := net.ListenPacket(\"udp4\", \"127.0.0.1:0\")\nif err != nil {\n    tb.Fatal(\"Can't listen:\", err)\n}\nudpConn := conn.(*net.UDPConn)\n\n// We don't want to allow anyone to use more than 128 packets per second\nppsPerSecond := 128\nrake, err := New(udpConn, ppsPerSecond)\ndefer rake.Close()\n// rate limiter stays active even after closing\n```\n\nThat's all! The library now enforces rate limits on incoming packets, and it happens within the kernel.\n\n## Requirements\n\nThe library should be go-gettable, and has been tested on Linux 5.11.\n\nYou may have to increase optmem_max depending on your distribution:\n\n```\nsudo sysctl -w net.core.optmem_max=22528\n```\n\nYou will need a `clang-12` binary if you want to recompile the filter. Simply run `go generate` in the root of the project.\n\n## Limitations\n- IPv6 doesn't support options\n- requires tweaking of optmem\n- not tested in production\n\n## Testing\n\n```\ngo test .\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Frakelimit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflare%2Frakelimit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflare%2Frakelimit/lists"}