// GetLimiter returns the rate limiter for the provided IP address if it exists.
// Otherwise calls AddIP to add IP address to the map
GetLimiter returns the rate limiter for the provided IP address if it exists.
Otherwise calls AddIP to add IP address to the map
// GetLimiter returns the rate limiter for the provided IP address if it exists . // Otherwise calls AddIP to add IP address to the map
func (i *IPRateLimiter) GetLimiter(username string) *rate.Limiter {
    i.mu.Lock()
    limiter, exists := i.ips[username]
    if !exists {
        i.mu.Unlock()
        return i.AddUsername(username)
    }
    i.mu.Unlock()
    return limiter
}
func ( i * IPRateLimiter ) GetLimiter ( username string ) * rate . Limiter { i . mu . Lock ( ) limiter , exists := i . ips [ username ] if ! exists { i . mu . Unlock ( ) return i . AddUsername ( username ) } i . mu . Unlock ( ) return limiter }
GetLimiter returns the rate limiter for the provided IP address if it exists.
GetLimiter returns the rate limiter for the provided IP address if it exists .