class Rack::Attack::Fail2Ban

Public Class Methods

banned_ip_keys() click to toggle source
# File lib/rack/attack_extensions.rb, line 305
def banned_ip_keys
  keys.grep(/(allow|fail)2ban:ban:/)
end
full_key_prefix() click to toggle source
# File lib/rack/attack_extensions.rb, line 309
def full_key_prefix
  "#{cache.prefix}:#{key_prefix}"
end
keys() click to toggle source

AKA unprefixed_keys Removes the Rack::Attack.cache.prefix, but not 'allow2ban'

# File lib/rack/attack_extensions.rb, line 293
def keys
  prefixed_keys.map { |key|
    Rack::Attack.unprefix_key(key)
  }
end
prefixed_keys() click to toggle source
# File lib/rack/attack_extensions.rb, line 287
def prefixed_keys
  Rack::Attack.all_keys.grep(/^#{cache.prefix}:(allow|fail)2ban:/)
end
to_h() click to toggle source
# File lib/rack/attack_extensions.rb, line 299
def to_h
  keys.each_with_object({}) do |k, h|
    h[k] = cache.store.read(k)
  end
end