go-proxy/ratelimit_test.go
Virgil a38dfc18ec feat(proxy): implement RFC surface
Co-Authored-By: Virgil <virgil@lethean.io>
2026-04-04 10:29:02 +00:00

13 lines
316 B
Go

package proxy
import "testing"
func TestRateLimiter_Allow(t *testing.T) {
rl := NewRateLimiter(RateLimit{MaxConnectionsPerMinute: 1, BanDurationSeconds: 1})
if !rl.Allow("1.2.3.4:1234") {
t.Fatalf("expected first call to pass")
}
if rl.Allow("1.2.3.4:1234") {
t.Fatalf("expected second call to fail")
}
}