Skip to content

IP2Proxy Ruby on Rails library allows user to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges, residential proxies, consumer privacy networks, and enterprise private networks using IP2Proxy BIN database.

License

Notifications You must be signed in to change notification settings

ip2location/ip2proxy-rails

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Stable Version Total Downloads

IP2Proxy Ruby on Rails Library

This IP2Proxy Ruby on Rails library allows user to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges, residential proxies, consumer privacy networks, and enterprise private networks using IP2Proxy BIN database. Other information available includes proxy type, country, state, city, ISP, domain name, usage type, AS number, AS name, threats, last seen date and provider names. It lookup the proxy IP address from IP2Proxy BIN Data file.

INSTALLATION

  1. Add this lines to your application's Gemfile:
gem 'ip2proxy_ruby'
gem 'ip2proxy_rails'
  1. Then execute it
$ bundle install
  1. Open the preferred file in the config/environments directory. Add the following code to the chosen configuration file after the Rails.application.configure do line.
config.ip2proxy_db_path = Rails.root.join('lib', 'assets', 'ip2proxy_rails', 'IP2PROXY.BIN').to_s

USAGE

  1. Download IP2Proxy BIN database
  2. Create a folder named as ip2proxy_rails in the lib/assets directory.
  3. Unzip and copy the BIN file into lib/assets/ip2proxy_rails folder.
  4. Rename the BIN file to IP2PROXY.BIN.
  5. Create a TestController using the below command line
bin/rails generate controller Test index --skip-routes
  1. Open the app/controllers/test_controller.rb in any text editor.
  2. Add the below lines into the controller file.
require 'ip2proxy_rails'

class TestController < ApplicationController
  def index
    proxy_service = Ip2proxyRails.new('1.2.3.4')
    @is_proxy = proxy_service.is_proxy
    @proxy_type = proxy_service.proxy_type
    @country_code = proxy_service.country_code
    @country_name = proxy_service.country_name
    @region = proxy_service.region
    @city = proxy_service.city
    @isp = proxy_service.isp
    @domain = proxy_service.domain
    @usage_type = proxy_service.usagetype
    @asn = proxy_service.asn
    @as = proxy_service.as
    @last_seen = proxy_service.last_seen
    @threat = proxy_service.threat
    @provider = proxy_service.provider
    @fraud_score = proxy_service.fraud_score
  end
end
  1. Open the app/views/test/index.html.erb in any text editor and add the below lines into it.
<p>is Proxy: <%= @is_proxy %></p>
<p>Proxy Type: <%= @proxy_type %></p>
<p>Country Code: <%= @country_code %></p>
<p>Country Name: <%= @country_name %></p>
<p>Region Name: <%= @region %></p>
<p>City Name: <%= @city %></p>
<p>ISP Name: <%= @isp %></p>
<p>Domain Name: <%= @domain %></p>
<p>Usage Type: <%= @usage_type %></p>
<p>ASN: <%= @asn %></p>
<p>AS: <%= @as %></p>
<p>Last Seen: <%= @last_seen %></p>
<p>Threat: <%= @threat %></p>
<p>Provider: <%= @provider %></p>
<p>Fraud Score: <%= @fraud_score %></p>
  1. Add the following line into the config/routes.rb file after the Rails.application.routes.draw do line.
get "/test", to: "test#index"
  1. Restart your development server.
$ bin/rails server
  1. Enter the URL /test and run. You should see the proxy information of 1.2.3.4 IP address.

Dependencies

This library requires IP2Proxy BIN data file to function. You may download the BIN data file at

Support

Email: support@ip2location.com URL: https://www.ip2location.com

About

IP2Proxy Ruby on Rails library allows user to reverse search of IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges, residential proxies, consumer privacy networks, and enterprise private networks using IP2Proxy BIN database.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages