mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-13 12:22:04 +00:00
feat(multiplayer): enforce account and IP rate limits
This commit is contained in:
@@ -207,7 +207,7 @@ func (s *Service) Handler() http.Handler {
|
||||
var handler http.Handler = mux
|
||||
if s.RateLimiter != nil {
|
||||
handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
if !s.RateLimiter.Allow(requestRateKey(r), s.now()) {
|
||||
if !s.RateLimiter.AllowKeys(requestRateKeys(r), s.now()) {
|
||||
writeError(w, http.StatusTooManyRequests, "rate_limited")
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user