Class: WebConsole::Request::GetSecureIp

Inherits:
ActionDispatch::RemoteIp::GetIp
  • Object
show all
Defined in:
lib/web_console/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(req, proxies) ⇒ GetSecureIp

Returns a new instance of GetSecureIp.



20
21
22
23
24
25
26
27
28
29
# File 'lib/web_console/request.rb', line 20

def initialize(req, proxies)
  # After rails/rails@07b2ff0 ActionDispatch::RemoteIp::GetIp initializes
  # with a ActionDispatch::Request object instead of plain Rack
  # environment hash. Keep both @req and @env here, so we don't if/else
  # on Rails versions.
  @req      = req
  @env      = req.env
  @check_ip = true
  @proxies  = proxies
end

Instance Method Details

#filter_proxies(ips) ⇒ Object



31
32
33
34
35
# File 'lib/web_console/request.rb', line 31

def filter_proxies(ips)
  ips.reject do |ip|
    @proxies.include?(ip)
  end
end