Class: Wafris::IpResolver
- Inherits:
-
Object
- Object
- Wafris::IpResolver
- Defined in:
- lib/wafris/ip_resolver.rb
Constant Summary collapse
- IP_HEADERS =
List of possible IP headers in order of priority
%w[ HTTP_X_REAL_IP HTTP_X_TRUE_CLIENT_IP HTTP_FLY_CLIENT_IP HTTP_CF_CONNECTING_IP ].freeze
Instance Method Summary collapse
-
#initialize(request) ⇒ IpResolver
constructor
A new instance of IpResolver.
- #resolve ⇒ Object
Constructor Details
#initialize(request) ⇒ IpResolver
Returns a new instance of IpResolver.
13 14 15 16 |
# File 'lib/wafris/ip_resolver.rb', line 13 def initialize(request) @request_env = request.env @ip = request.ip end |
Instance Method Details
#resolve ⇒ Object
18 19 20 21 22 |
# File 'lib/wafris/ip_resolver.rb', line 18 def resolve return @request_env[ip_header] if ip_header @ip end |