Refactor ActionDispatch::RemoteIp

Refactored IP address checking in ActionDispatch::RemoteIp to rely on
the IPAddr class instead of the unwieldly regular expression to match
IP addresses. This commit keeps the same api but allows users to pass
IPAddr objects to config.action_dispatch.trusted_proxies in addition
to passing strings and regular expressions.

Example:

    # config/environments/production.rb
    config.action_dispatch.trusted_proxies = IPAddr.new('4.8.15.0/16')
Merge pull request #16604 from saarons/clean-remote-ip-middleware

ActionDispatch::RemoteIp accept IPAddr matches for trusted proxies