khatru: don't ratelimit localhost connections.
This commit is contained in:
@@ -33,7 +33,11 @@ func ConnectionRateLimiter(tokensPerInterval int, interval time.Duration, maxTok
|
|||||||
rl := startRateLimitSystem[string](tokensPerInterval, interval, maxTokens)
|
rl := startRateLimitSystem[string](tokensPerInterval, interval, maxTokens)
|
||||||
|
|
||||||
return func(r *http.Request) bool {
|
return func(r *http.Request) bool {
|
||||||
return rl(khatru.GetIPFromRequest(r))
|
ip := khatru.GetIPFromRequest(r)
|
||||||
|
if ip == "127.0.0.1" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return rl(ip)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user