mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-23 05:02:17 +00:00
feat: Add distributed Redis-based rate limiting with sliding window, token bucket, and multi-tier support
- Add RedisRateLimiter struct with client/prefix/limit/window fields for distributed rate limit tracking - Add RateLimitResult struct with allowed/remaining/reset_time/total_limit/retry_after fields - Add NewRedisRateLimiter constructor and Allow method with Lua script for atomic sliding window operations - Add AllowTokenBucket method with token bucket algorithm using Redis HMSET for refill rate
This commit is contained in:
@@ -4,6 +4,7 @@ go 1.26
|
||||
|
||||
require (
|
||||
github.com/gin-gonic/gin v1.12.0
|
||||
github.com/go-redis/redis/v8 v8.11.5
|
||||
github.com/golang-jwt/jwt/v5 v5.2.2
|
||||
github.com/stretchr/testify v1.11.1
|
||||
github.com/swaggo/files v1.0.1
|
||||
|
||||
Reference in New Issue
Block a user