ip2proxy_ruby 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b9440307fd3da2ce5561eaa479425d3295776a66
4
- data.tar.gz: 477d7501345f21bf9c7f3c7a7d1e9faf592991d6
2
+ SHA256:
3
+ metadata.gz: 2c78484a2688f93868d5de9ada23bf1b9ce0b8ede672310e841269c3e55dcb4a
4
+ data.tar.gz: 8984b09192407fb219ea0e3e68f5324fc69456150eefaaeb087db8b14cbb05be
5
5
  SHA512:
6
- metadata.gz: cde7bac539db121e998b988ef27a32ac9774285ba5dcbf8c245a9fea7bd3fc5db30f42af32e335ffba2a047f88cfd9b2ae584d336f1e81a7cd42380eea897919
7
- data.tar.gz: 72867604ac534149ed11ad8b14b6b803d4b4bfd4b40394ff80c369fd96ee934b8757f5edac145cf0004c1e2d2bd38e59ea2302caf5b387002f5bf07ef7a23eb4
6
+ metadata.gz: 754614eeca4b9db1c69956460f277132d95bc872dc083eb732b44dcc05b6866aa67e160d216d0853ed58fe30d08e9b2e7be219870be4914e3712ce7cbfb9c7af
7
+ data.tar.gz: da8b691e0b4ff992f544a865d720e5c3b25fdac0ca712e069b27ec626f6c3dbbe46eb2979508b7d5239f8a6dc0e643d1c1b1eb3ae4f9fcf4c15b2d970aba461b
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 IP2Location ( support@ip2location.com )
1
+ Copyright (c) 2018 IP2Location ( support@ip2location.com )
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,47 +1,71 @@
1
- # IP2Proxy Ruby Library
2
-
3
- This is IP2Proxy Ruby library that lookup IP address to detect VPN servers, open proxies, web proxies, Tor exit nodes and data center ranges. The library reads the geo location information from [IP2Proxy database](https://www.ip2location.com/proxy-database)
4
-
5
- For more details, please visit:
6
- [https://www.ip2location.com/ip2proxy/developers/ruby](https://www.ip2location.com/ip2proxy/developers/ruby)
7
-
8
- ## Usage
9
-
10
- ```
11
- require 'ip2proxy_ruby'
12
-
13
- # open IP2Proxy BIN database for proxy lookup
14
- i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
15
-
16
- # get versioning information
17
- print 'Module Version: ' + i2p.getModuleVersion + "\n"
18
- print 'Package Version: ' + i2p.getPackageVersion + "\n"
19
- print 'Database Version: ' + i2p.getDatabaseVersion + "\n"
20
-
21
- # individual proxy data check
22
- print 'Is Proxy: ' + i2p.isProxy('4.0.0.47').to_s + "\n"
23
- print 'Proxy Type: ' + i2p.getProxyType('4.0.0.47') + "\n"
24
- print 'Country Code: ' + i2p.getCountryShort('4.0.0.47') + "\n"
25
- print 'Country Name: ' + i2p.getCountryLong('4.0.0.47') + "\n"
26
- print 'Region Name: ' + i2p.getRegion('4.0.0.47') + "\n"
27
- print 'City Name: ' + i2p.getCity('4.0.0.47') + "\n"
28
- print 'ISP: ' + i2p.getISP('4.0.0.47') + "\n"
29
-
30
- # single function to get all proxy data returned in array
31
- record = i2p.getAll('4.0.0.47')
32
- print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
33
- print 'Proxy Type: ' + record['proxy_type'] + "\n"
34
- print 'Country Code: ' + record['country_short'] + "\n"
35
- print 'Country Name: ' + record['country_long'] + "\n"
36
- print 'Region Name: ' + record['region'] + "\n"
37
- print 'City Name: ' + record['city'] + "\n"
38
- print 'ISP: ' + record['isp'] + "\n"
39
-
40
- # close IP2Proxy BIN database
41
- i2p.close()
42
- ```
43
-
44
- ## Support
45
-
46
- Email: support@ip2location.com
47
- URL: [http://www.ip2location.com](http://www.ip2location.com)
1
+ # IP2Proxy Ruby Library
2
+
3
+ This module allows user to query an IP address if it was being used as open proxy, web proxy, VPN anonymizer and TOR exits. It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
4
+
5
+ * Free IP2Proxy BIN Data: https://lite.ip2location.com
6
+ * Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
7
+
8
+
9
+ For more details, please visit:
10
+ [https://www.ip2location.com/ip2proxy/developers/ruby](https://www.ip2location.com/ip2proxy/developers/ruby)
11
+
12
+ ## Methods
13
+
14
+ Below are the methods supported in this module.
15
+
16
+ |Method Name|Description|
17
+ |---|---|
18
+ |open|Open the IP2Proxy BIN data with **File I/O** mode for lookup.|
19
+ |close|Close and clean up the file pointer.|
20
+ |get_package_version|Get the package version (1 to 4 for PX1 to PX4 respectively).|
21
+ |get_module_version|Get the module version.|
22
+ |get_database_version|Get the database version.|
23
+ |is_proxy|Check whether if an IP address was a proxy. Returned value:<ul><li>-1 : errors</li><li>0 : not a proxy</li><li>1 : a proxy</li><li>2 : a data center IP address</li></ul>|
24
+ |get_all|Return the proxy information in array.|
25
+ |get_proxytype|Return the proxy type. Please visit <a href="https://www.ip2location.com/databases/px4-ip-proxytype-country-region-city-isp" target="_blank">IP2Location</a> for the list of proxy types supported|
26
+ |get_country_short|Return the ISO3166-1 country code (2-digits) of the proxy.|
27
+ |get_country_long|Return the ISO3166-1 country name of the proxy.|
28
+ |get_region|Return the ISO3166-2 region name of the proxy. Please visit <a href="https://www.ip2location.com/free/iso3166-2" target="_blank">ISO3166-2 Subdivision Code</a> for the information of ISO3166-2 supported|
29
+ |get_city|Return the city name of the proxy.|
30
+ |get_isp|Return the ISP name of the proxy.|
31
+
32
+ ## Usage
33
+
34
+ ```
35
+ require 'ip2proxy_ruby'
36
+
37
+ # open IP2Proxy BIN database for proxy lookup
38
+ i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
39
+
40
+ # get versioning information
41
+ print 'Module Version: ' + i2p.get_module_version + "\n"
42
+ print 'Package Version: ' + i2p.get_package_version + "\n"
43
+ print 'Database Version: ' + i2p.get_database_version + "\n"
44
+
45
+ # individual proxy data check
46
+ print 'Is Proxy: ' + i2p.is_proxy('4.0.0.47').to_s + "\n"
47
+ print 'Proxy Type: ' + i2p.get_proxytype('4.0.0.47') + "\n"
48
+ print 'Country Code: ' + i2p.get_country_short('4.0.0.47') + "\n"
49
+ print 'Country Name: ' + i2p.get_country_long('4.0.0.47') + "\n"
50
+ print 'Region Name: ' + i2p.get_region('4.0.0.47') + "\n"
51
+ print 'City Name: ' + i2p.get_city('4.0.0.47') + "\n"
52
+ print 'ISP: ' + i2p.get_isp('4.0.0.47') + "\n"
53
+
54
+ # single function to get all proxy data returned in array
55
+ record = i2p.get_all('4.0.0.47')
56
+ print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
57
+ print 'Proxy Type: ' + record['proxy_type'] + "\n"
58
+ print 'Country Code: ' + record['country_short'] + "\n"
59
+ print 'Country Name: ' + record['country_long'] + "\n"
60
+ print 'Region Name: ' + record['region'] + "\n"
61
+ print 'City Name: ' + record['city'] + "\n"
62
+ print 'ISP: ' + record['isp'] + "\n"
63
+
64
+ # close IP2Proxy BIN database
65
+ i2p.close()
66
+ ```
67
+
68
+ ## Support
69
+
70
+ Email: support@ip2location.com
71
+ URL: [https://www.ip2location.com](https://www.ip2location.com)
data/example.rb CHANGED
@@ -4,21 +4,21 @@ require 'ip2proxy_ruby'
4
4
  i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
5
5
 
6
6
  # get versioning information
7
- print 'Module Version: ' + i2p.getModuleVersion + "\n"
8
- print 'Package Version: ' + i2p.getPackageVersion + "\n"
9
- print 'Database Version: ' + i2p.getDatabaseVersion + "\n"
7
+ print 'Module Version: ' + i2p.get_module_version + "\n"
8
+ print 'Package Version: ' + i2p.get_package_version + "\n"
9
+ print 'Database Version: ' + i2p.get_database_version + "\n"
10
10
 
11
11
  # individual proxy data check
12
- print 'Is Proxy: ' + i2p.isProxy('4.0.0.47').to_s + "\n"
13
- print 'Proxy Type: ' + i2p.getProxyType('4.0.0.47') + "\n"
14
- print 'Country Code: ' + i2p.getCountryShort('4.0.0.47') + "\n"
15
- print 'Country Name: ' + i2p.getCountryLong('4.0.0.47') + "\n"
16
- print 'Region Name: ' + i2p.getRegion('4.0.0.47') + "\n"
17
- print 'City Name: ' + i2p.getCity('4.0.0.47') + "\n"
18
- print 'ISP: ' + i2p.getISP('4.0.0.47') + "\n"
12
+ print 'Is Proxy: ' + i2p.is_proxy('4.0.0.47').to_s + "\n"
13
+ print 'Proxy Type: ' + i2p.get_proxytype('4.0.0.47') + "\n"
14
+ print 'Country Code: ' + i2p.get_country_short('4.0.0.47') + "\n"
15
+ print 'Country Name: ' + i2p.get_country_long('4.0.0.47') + "\n"
16
+ print 'Region Name: ' + i2p.get_region('4.0.0.47') + "\n"
17
+ print 'City Name: ' + i2p.get_city('4.0.0.47') + "\n"
18
+ print 'ISP: ' + i2p.get_isp('4.0.0.47') + "\n"
19
19
 
20
20
  # single function to get all proxy data returned in array
21
- record = i2p.getAll('4.0.0.47')
21
+ record = i2p.get_all('4.0.0.47')
22
22
  print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
23
23
  print 'Proxy Type: ' + record['proxy_type'] + "\n"
24
24
  print 'Country Code: ' + record['country_short'] + "\n"
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "ip2proxy_ruby"
5
- s.version = "1.0.2"
5
+ s.version = "1.0.3"
6
6
  s.authors = ["ip2location"]
7
7
  s.email = ["support@ip2location.com"]
8
8
 
data/lib/ip2proxy_ruby.rb CHANGED
@@ -9,7 +9,7 @@ require_relative 'ip2proxy_ruby/ip2proxy_record'
9
9
  class Ip2proxy
10
10
  attr_accessor :record_class4, :record_class6, :v4, :file, :db_index, :count, :base_addr, :ipno, :record, :database, :columns, :ip_version, :ipv4databasecount, :ipv4databaseaddr, :ipv4indexbaseaddr, :ipv6databasecount, :ipv6databaseaddr, :ipv6indexbaseaddr, :databaseyear, :databasemonth, :databaseday
11
11
 
12
- VERSION = '1.0.2'
12
+ VERSION = '1.0.3'
13
13
  FIELD_NOT_SUPPORTED = 'NOT SUPPORTED'
14
14
  INVALID_IP_ADDRESS = 'INVALID IP ADDRESS'
15
15
 
@@ -37,15 +37,15 @@ class Ip2proxy
37
37
  self.file.close
38
38
  end
39
39
 
40
- def getModuleVersion()
40
+ def get_module_version()
41
41
  return VERSION
42
42
  end
43
43
 
44
- def getPackageVersion()
44
+ def get_package_version()
45
45
  return (self.db_index).to_s
46
46
  end
47
47
 
48
- def getDatabaseVersion()
48
+ def get_database_version()
49
49
  return (self.databaseyear).to_s + "." + (self.databasemonth).to_s + "." + (self.databaseday).to_s
50
50
  end
51
51
 
@@ -77,7 +77,7 @@ class Ip2proxy
77
77
  end
78
78
  end
79
79
 
80
- def getCountryShort(ip)
80
+ def get_country_short(ip)
81
81
  valid = !(IPAddr.new(ip) rescue nil).nil?
82
82
  if valid
83
83
  rec = get_record(ip)
@@ -92,7 +92,7 @@ class Ip2proxy
92
92
  return country_short
93
93
  end
94
94
 
95
- def getCountryLong(ip)
95
+ def get_country_long(ip)
96
96
  valid = !(IPAddr.new(ip) rescue nil).nil?
97
97
  if valid
98
98
  rec = get_record(ip)
@@ -107,7 +107,7 @@ class Ip2proxy
107
107
  return country_long
108
108
  end
109
109
 
110
- def getRegion(ip)
110
+ def get_region(ip)
111
111
  valid = !(IPAddr.new(ip) rescue nil).nil?
112
112
  if valid
113
113
  rec = get_record(ip)
@@ -122,7 +122,7 @@ class Ip2proxy
122
122
  return region
123
123
  end
124
124
 
125
- def getCity(ip)
125
+ def get_city(ip)
126
126
  valid = !(IPAddr.new(ip) rescue nil).nil?
127
127
  if valid
128
128
  rec = get_record(ip)
@@ -137,7 +137,7 @@ class Ip2proxy
137
137
  return city
138
138
  end
139
139
 
140
- def getISP(ip)
140
+ def get_isp(ip)
141
141
  valid = !(IPAddr.new(ip) rescue nil).nil?
142
142
  if valid
143
143
  rec = get_record(ip)
@@ -152,7 +152,7 @@ class Ip2proxy
152
152
  return isp
153
153
  end
154
154
 
155
- def getProxyType(ip)
155
+ def get_proxytype(ip)
156
156
  valid = !(IPAddr.new(ip) rescue nil).nil?
157
157
  if valid
158
158
  rec = get_record(ip)
@@ -167,7 +167,7 @@ class Ip2proxy
167
167
  return proxytype
168
168
  end
169
169
 
170
- def isProxy(ip)
170
+ def is_proxy(ip)
171
171
  valid = !(IPAddr.new(ip) rescue nil).nil?
172
172
  if valid
173
173
  rec = get_record(ip)
@@ -186,7 +186,7 @@ class Ip2proxy
186
186
  return isproxy
187
187
  end
188
188
 
189
- def getAll(ip)
189
+ def get_all(ip)
190
190
  valid = !(IPAddr.new(ip) rescue nil).nil?
191
191
  if valid
192
192
  rec = get_record(ip)
@@ -3,7 +3,7 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe "Ip2proxy" do
4
4
  it "work correctly with ipv4" do
5
5
  i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
6
- record = i2p.getAll('1.0.241.135')
6
+ record = i2p.get_all('1.0.241.135')
7
7
  record.should_not be_nil
8
8
  record['is_proxy'].should == 1
9
9
  i2p.close()
@@ -11,7 +11,7 @@ describe "Ip2proxy" do
11
11
 
12
12
  it "work correctly with ipv6" do
13
13
  i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
14
- record = i2p.getAll('2001::')
14
+ record = i2p.get_all('2001::')
15
15
  record.should_not be_nil
16
16
  record['is_proxy'].should == 0
17
17
  i2p.close()
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip2proxy_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ip2location
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-10 00:00:00.000000000 Z
11
+ date: 2018-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
142
  version: '0'
143
143
  requirements: []
144
144
  rubyforge_project:
145
- rubygems_version: 2.6.8
145
+ rubygems_version: 2.7.7
146
146
  signing_key:
147
147
  specification_version: 4
148
148
  summary: IP2Proxy Ruby library