ip2proxy_rails 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 6cecab9d7489f099dba3ad64fa7438deefb56faf7ab6cde65ccd7671a57f9fb4
4
+ data.tar.gz: c5cb514d16e736a38a2f2d522c456f6ea48bb8aea372f7e42a078cb07f454d23
5
+ SHA512:
6
+ metadata.gz: 952b3e2a65850d6eb35d0ff8245f05e3df0b8eabcf480618c4d8e645ee7369da0462fdce4ac9b51578fbb885c0d7a138ad4e1c1b70909ee12c362436753f624a
7
+ data.tar.gz: b5cbe1acf3c4835475403a315ede9a43a3239456540d5c5424df6f4a907538e5480962242c0c455abc323d463b6b298007a06362a9b144279f7df370d4711248
data/Gemfile ADDED
@@ -0,0 +1,5 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in ip2proxy_rails.gemspec
4
+ gemspec
5
+ gem 'ip2proxy_ruby', ">= 3.3.1"
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2023 - 2024 IP2Location ( support@ip2location.com )
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # IP2Proxy Ruby on Rails Library
2
+ 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.
3
+
4
+ ## INSTALLATION
5
+ 1. Add this lines to your application's Gemfile:
6
+ ```ruby
7
+ gem 'ip2proxy_ruby'
8
+ gem 'ip2proxy_rails'
9
+ ```
10
+ 2. Then execute it
11
+ ```bash
12
+ $ bundle install
13
+ ```
14
+ 3. 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.
15
+ ```ruby
16
+ config.ip2proxy_db_path = Rails.root.join('lib', 'assets', 'ip2proxy_rails', 'IP2PROXY.BIN').to_s
17
+ ```
18
+
19
+ ## USAGE
20
+ 1. Download IP2Proxy BIN database
21
+ - IP2Proxy LITE database at https://lite.ip2location.com
22
+ - IP2Proxy Commercial database at https://www.ip2location.com/proxy-database
23
+ 2. Create a folder named as `ip2proxy_rails` in the `lib/assets` directory.
24
+ 3. Unzip and copy the BIN file into `lib/assets/ip2proxy_rails` folder.
25
+ 4. Rename the BIN file to **IP2PROXY.BIN**.
26
+ 5. Create a **TestController** using the below command line
27
+ ```bash
28
+ bin/rails generate controller Test index --skip-routes
29
+ ```
30
+ 6. Open the *app/controllers/test_controller.rb* in any text editor.
31
+ 7. Add the below lines into the controller file.
32
+ ```ruby
33
+ require 'ip2proxy_rails'
34
+
35
+ class TestController < ApplicationController
36
+ def index
37
+ proxy_service = Ip2proxyRails.new('1.2.3.4')
38
+ @is_proxy = proxy_service.is_proxy
39
+ @proxy_type = proxy_service.proxy_type
40
+ @country_code = proxy_service.country_code
41
+ @country_name = proxy_service.country_name
42
+ @region = proxy_service.region
43
+ @city = proxy_service.city
44
+ @isp = proxy_service.isp
45
+ @domain = proxy_service.domain
46
+ @usage_type = proxy_service.usagetype
47
+ @asn = proxy_service.asn
48
+ @as = proxy_service.as
49
+ @last_seen = proxy_service.last_seen
50
+ @threat = proxy_service.threat
51
+ @provider = proxy_service.provider
52
+ end
53
+ end
54
+ ```
55
+ 8. Open the *app/views/test/index.html.erb* in any text editor and add the below lines into it.
56
+ ```
57
+ <p>is Proxy: <%= @is_proxy %></p>
58
+ <p>Proxy Type: <%= @proxy_type %></p>
59
+ <p>Country Code: <%= @country_code %></p>
60
+ <p>Country Name: <%= @country_name %></p>
61
+ <p>Region Name: <%= @region %></p>
62
+ <p>City Name: <%= @city %></p>
63
+ <p>ISP Name: <%= @isp %></p>
64
+ <p>Domain Name: <%= @domain %></p>
65
+ <p>Usage Type: <%= @usage_type %></p>
66
+ <p>ASN: <%= @asn %></p>
67
+ <p>AS: <%= @as %></p>
68
+ <p>Last Seen: <%= @last_seen %></p>
69
+ <p>Threat: <%= @threat %></p>
70
+ <p>Provider: <%= @provider %></p>
71
+ ```
72
+ 9. Add the following line into the *config/routes.rb* file after the `Rails.application.routes.draw do` line.
73
+ ```ruby
74
+ get "/test", to: "test#index"
75
+ ```
76
+ 10. Restart your development server.
77
+ ```bash
78
+ $ bin/rails server
79
+ ```
80
+ 11. Enter the URL <your domain>/test and run. You should see the proxy information of **1.2.3.4** IP address.
81
+
82
+ ## Dependencies
83
+ This library requires IP2Proxy BIN data file to function. You may download the BIN data file at
84
+ * IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
85
+ * IP2Proxy Commercial BIN Data (Comprehensive): https://www.ip2location.com/proxy-database
86
+
87
+ ## Support
88
+ Email: support@ip2location.com
89
+ URL: [https://www.ip2location.com](https://www.ip2location.com)
@@ -0,0 +1,20 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'ip2proxy_rails'
3
+ s.version = '1.0.0'
4
+ s.required_ruby_version = '>= 2.5.0'
5
+ s.require_paths = ["lib"]
6
+ s.authors = ["ip2location"]
7
+ s.email = ["support@ip2location.com"]
8
+ s.description = "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."
9
+ s.summary = "IP2Proxy Ruby on Rails library"
10
+ s.homepage = 'https://www.ip2location.com'
11
+ s.licenses = ["MIT"]
12
+ s.files = [
13
+ "LICENSE.txt",
14
+ "Gemfile",
15
+ "README.md",
16
+ "ip2proxy_rails.gemspec",
17
+ "lib/ip2proxy_rails.rb",
18
+ ]
19
+ s.add_runtime_dependency 'ip2proxy_ruby', '>= 3.3.1'
20
+ end
@@ -0,0 +1,68 @@
1
+ require 'ip2proxy_ruby'
2
+
3
+ class Ip2proxyRails
4
+ def initialize(ip_address)
5
+ @ip_address = ip_address
6
+ @i2p = Ip2proxy.new.open(Rails.configuration.ip2proxy_db_path)
7
+ end
8
+
9
+ def proxy
10
+ @i2p.get_all(@ip_address)
11
+ end
12
+
13
+ def is_proxy
14
+ proxy['is_proxy'].to_s
15
+ end
16
+
17
+ def proxy_type
18
+ proxy['proxy_type']
19
+ end
20
+
21
+ def country_code
22
+ proxy['country_short']
23
+ end
24
+
25
+ def country_name
26
+ proxy['country_long']
27
+ end
28
+
29
+ def region
30
+ proxy['region']
31
+ end
32
+
33
+ def city
34
+ proxy['city']
35
+ end
36
+
37
+ def isp
38
+ proxy['isp']
39
+ end
40
+
41
+ def domain
42
+ proxy['domain']
43
+ end
44
+
45
+ def usagetype
46
+ proxy['usagetype']
47
+ end
48
+
49
+ def asn
50
+ proxy['asn']
51
+ end
52
+
53
+ def as
54
+ proxy['as']
55
+ end
56
+
57
+ def last_seen
58
+ proxy['last_seen']
59
+ end
60
+
61
+ def threat
62
+ proxy['threat']
63
+ end
64
+
65
+ def provider
66
+ proxy['provider']
67
+ end
68
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ip2proxy_rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - ip2location
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: ip2proxy_ruby
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 3.3.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 3.3.1
27
+ description: This IP2Proxy Ruby on Rails library allows user to reverse search of
28
+ IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes, search
29
+ engine robots, data center ranges, residential proxies, consumer privacy networks,
30
+ and enterprise private networks using IP2Proxy BIN database. Other information available
31
+ includes proxy type, country, state, city, ISP, domain name, usage type, AS number,
32
+ AS name, threats, last seen date and provider names. It lookup the proxy IP address
33
+ from IP2Proxy BIN Data file.
34
+ email:
35
+ - support@ip2location.com
36
+ executables: []
37
+ extensions: []
38
+ extra_rdoc_files: []
39
+ files:
40
+ - Gemfile
41
+ - LICENSE.txt
42
+ - README.md
43
+ - ip2proxy_rails.gemspec
44
+ - lib/ip2proxy_rails.rb
45
+ homepage: https://www.ip2location.com
46
+ licenses:
47
+ - MIT
48
+ metadata: {}
49
+ post_install_message:
50
+ rdoc_options: []
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ">="
56
+ - !ruby/object:Gem::Version
57
+ version: 2.5.0
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ requirements: []
64
+ rubygems_version: 3.5.23
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: IP2Proxy Ruby on Rails library
68
+ test_files: []