server auth

This commit is contained in:
2026-05-28 08:35:50 -04:00
parent 3d44a392f1
commit fc63f9c44a
37 changed files with 3877 additions and 74 deletions

View File

@@ -0,0 +1,19 @@
package httpserver
import (
"testing"
"time"
)
func TestRateLimiterRejectsAfterLimit(t *testing.T) {
limiter := newRateLimiter(2, time.Minute)
if !limiter.Allow("ip:path") {
t.Fatal("first attempt should be allowed")
}
if !limiter.Allow("ip:path") {
t.Fatal("second attempt should be allowed")
}
if limiter.Allow("ip:path") {
t.Fatal("third attempt should be rate limited")
}
}