From a09429236e7270b5401198792c1a8f5e0450ccbe Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Wed, 3 Sep 2025 21:32:17 -0300 Subject: [PATCH] khatru: disable ratelimit for local ipv6 too. --- khatru/policies/ratelimits.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/khatru/policies/ratelimits.go b/khatru/policies/ratelimits.go index 6c806a7..0f5474d 100644 --- a/khatru/policies/ratelimits.go +++ b/khatru/policies/ratelimits.go @@ -14,7 +14,7 @@ func EventIPRateLimiter(tokensPerInterval int, interval time.Duration, maxTokens return func(ctx context.Context, _ nostr.Event) (reject bool, msg string) { ip := khatru.GetIP(ctx) - if ip == "127.0.0.1" { + if ip == "127.0.0.1" || ip == "::1" { return false, "" } return rl(ip), "rate-limited: slow down, please" @@ -26,7 +26,7 @@ func EventPubKeyRateLimiter(tokensPerInterval int, interval time.Duration, maxTo return func(ctx context.Context, evt nostr.Event) (reject bool, msg string) { ip := khatru.GetIP(ctx) - if ip == "127.0.0.1" { + if ip == "127.0.0.1" || ip == "::1" { return false, "" } return rl(evt.PubKey.Hex()), "rate-limited: slow down, please" @@ -38,7 +38,7 @@ func ConnectionRateLimiter(tokensPerInterval int, interval time.Duration, maxTok return func(r *http.Request) bool { ip := khatru.GetIPFromRequest(r) - if ip == "127.0.0.1" { + if ip == "127.0.0.1" || ip == "::1" { return false } return rl(ip)