Fix certain IPs not being recognized as proxies.
Fix certain IPs (namely Digital Ocean IPs) no longer being recognized as proxy IPs by the Ipregistry.co API. Caused by some sudden change in the API.
This commit is contained in:
@@ -49,6 +49,7 @@ class IpLookup
|
||||
|
||||
def is_proxy?
|
||||
return true if ip_addr.is_tor?
|
||||
return true if response.dig(:connection, :type) == "hosting"
|
||||
response[:security].present? && response[:security].values.any?
|
||||
end
|
||||
|
||||
|
||||
@@ -57,13 +57,13 @@ class IpGeolocationTest < ActiveSupport::TestCase
|
||||
|
||||
should "work for a proxy IP" do
|
||||
@ip = IpGeolocation.create_or_update!("31.214.184.59")
|
||||
assert_equal("Soluciones Corporativas IP SL", @ip.organization)
|
||||
assert_equal("Soluciones Corporativas IP (SCIP)", @ip.organization)
|
||||
assert_equal(true, @ip.is_proxy?)
|
||||
end
|
||||
|
||||
should "work for a cloud hosting IP" do
|
||||
@ip = IpGeolocation.create_or_update!("157.230.244.215")
|
||||
assert_equal("DigitalOcean LLC", @ip.organization)
|
||||
assert_equal("DigitalOcean, LLC", @ip.organization)
|
||||
assert_equal(true, @ip.is_proxy?)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user