From b8bd532ddb329276f51785386cbb070516546dac Mon Sep 17 00:00:00 2001 From: minghinmatthewlam Date: Thu, 10 Oct 2024 21:06:46 -0400 Subject: [PATCH] fix typo --- internal/server/middleware.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/server/middleware.go b/internal/server/middleware.go index e32c342..0043360 100644 --- a/internal/server/middleware.go +++ b/internal/server/middleware.go @@ -49,25 +49,25 @@ func (l *Limiter) ServeHTTP(w http.ResponseWriter, r *http.Request, next http.Ha return } - clintIP := getClientIPFromRequest(l.proxyCount, r) + clientIP := getClientIPFromRequest(l.proxyCount, r) l.mutex.Lock() - if l.limitByKey(w, address) || l.limitByKey(w, clintIP) { + if l.limitByKey(w, address) || l.limitByKey(w, clientIP) { l.mutex.Unlock() return } l.cache.SetWithTTL(address, true, l.ttl) - l.cache.SetWithTTL(clintIP, true, l.ttl) + l.cache.SetWithTTL(clientIP, true, l.ttl) l.mutex.Unlock() next.ServeHTTP(w, r) if w.(negroni.ResponseWriter).Status() != http.StatusOK { l.cache.Remove(address) - l.cache.Remove(clintIP) + l.cache.Remove(clientIP) return } log.WithFields(log.Fields{ "address": address, - "clientIP": clintIP, + "clientIP": clientIP, }).Info("Maximum request limit has been reached") }