implemented leaky bucket, changed ip to identifier, added a bunch of documentation so the repo can serve as much of a journal entry as a collection of code. added a README in that effort too.

This commit is contained in:
2023-08-11 17:22:52 +03:00
parent 2c9f2a30f7
commit 32eddd3de6
3 changed files with 72 additions and 13 deletions

View File

@@ -1,7 +1,10 @@
"""
TODO: implement token bucket
- [ ] in-app
- [x] in-memory
- [ ] redis
TODO: implement leaky bucket
- in-app
- [x] in-memory
- [ ] redis
- [ ] redis cluster
- [ ] Flask middleware - https://flask.palletsprojects.com/en/2.1.x/quickstart/#hooking-in-wsgi-middleware
@@ -10,10 +13,13 @@ TODO: implement leaky bucket
- [ ] AWS API Gateway
- [ ] HAProxy Stick Tables - https://www.haproxy.com/blog/introduction-to-haproxy-stick-tables
- [ ] Cloudflare (Spectrum?)
TODO: implement expiring tokens
TODO: implement fixed window counter
TODO: implement sliding window log
TODO: implement sliding window counter
TODO: use session IDs instead of IP address
TODO: use session IDs or API keys instead of IP address
TODO: set headers appropriately in each case: https://www.ietf.org/archive/id/draft-polli-ratelimit-headers-02.html#name-ratelimit-headers-currently
TODO: implement different rate limiting for each endpoint, using a `cost` variable for a given task
"""
import flask as f