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") }