ip2proxy_ruby 3.0.0 → 3.2.1

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
2
  SHA256:
3
- metadata.gz: 2a0f076da57bce1ce3df8766d07dde4855d90601d5e184b5bb1c15a099e8342f
4
- data.tar.gz: 8c9ae8dcf68cf2d9447397299572bc82317bebca1d15bbd85124250306c664bb
3
+ metadata.gz: dd1e0bbbfed7c2c8810a7673dedb3b2217e9b15f2ee66db8996b0193c1f29954
4
+ data.tar.gz: 268884174492ad2fb1e359f499fb4f783f2ff0bcd07a075fb772d5dbbc80be45
5
5
  SHA512:
6
- metadata.gz: 7f546e8cc2e57db0130b996cc0b8d436b8897ea33a6c92f2346617d66475de8b89d651dbd472457ca691c8c71b6787e9138452c8dc07852ca3a0461f711c4774
7
- data.tar.gz: 904aa801ab54f8b9c00ca38121ab3011e78fea24273d902ae2f6a57fb3b8e7f8a37858697ff75b94c9ed0efb06c50013f337082d942f01b13f0a5d92513e9623
6
+ metadata.gz: ee2149410b6e181dc04055c245b35a43e26f32fa67443a35d88415e04389d0fca830b0aefdc33973ae9538aa5744dcb050a6d79916d8d9e0833ae581412b63d0
7
+ data.tar.gz: 9f6762d6926650eb3ef9b5b5dcb9ff1e36f342bb1f965612324a0c1a6c82f40890158d760d5d681c58ac8c76a98a6a6787fd98f432486b35bf6466d6f31a1f73
data/LICENSE.txt CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2019 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.
1
+ Copyright (c) 2021 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 CHANGED
@@ -1,131 +1,98 @@
1
- [![Latest Stable Version](https://img.shields.io/gem/v/ip2proxy_ruby.svg)](https://rubygems.org/gems/ip2proxy_ruby)
2
- [![Total Downloads](https://img.shields.io/gem/dt/ip2proxy_ruby.svg)](https://rubygems.org/gems/ip2proxy_ruby)
3
-
4
- # IP2Proxy Ruby Library
5
-
6
- This module 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 and residential proxies using IP2Proxy BIN database. Other information available includes proxy type, country, state, city, ISP, domain name, usage type, AS number, AS name, threats and last seen date.
7
-
8
- It lookup the proxy IP address from **IP2Proxy BIN Data** file. This data file can be downloaded at
9
-
10
- * Free IP2Proxy BIN Data: https://lite.ip2location.com
11
- * Commercial IP2Proxy BIN Data: https://www.ip2location.com/proxy-database
12
-
13
-
14
- For more details, please visit:
15
- [https://www.ip2location.com/ip2proxy/developers/ruby](https://www.ip2location.com/ip2proxy/developers/ruby)
16
-
17
- ## Methods
18
-
19
- Below are the methods supported in this module.
20
-
21
- |Method Name|Description|
22
- |---|---|
23
- |open|Open the IP2Proxy BIN data with **File I/O** mode for lookup.|
24
- |close|Close and clean up the file pointer.|
25
- |get_package_version|Get the package version (1 to 10 for PX1 to PX10 respectively).|
26
- |get_module_version|Get the module version.|
27
- |get_database_version|Get the database version.|
28
- |is_proxy|Check whether if an IP address was a proxy. Please see [Proxy Type](#proxy-type) for details. 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>|
29
- |get_all|Return the proxy information in array.|
30
- |get_proxytype|Return the proxy type. Please visit <a href="https://www.ip2location.com/database/px10-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen-threat-residential" target="_blank">IP2Location</a> for the list of proxy types supported|
31
- |get_country_short|Return the ISO3166-1 country code (2-digits) of the proxy.|
32
- |get_country_long|Return the ISO3166-1 country name of the proxy.|
33
- |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|
34
- |get_city|Return the city name of the proxy.|
35
- |get_isp|Return the ISP name of the proxy.|
36
- |get_domain|Return the domain name of proxy's IP address or domain name.|
37
- |get_usagetype|Return the ISP's usage type of proxy's IP address or domain name. Please see [Usage Type](#usage-type) for details.|
38
- |get_asn|Return the autonomous system number (ASN) of proxy's IP address or domain name.|
39
- |get_as|Return the autonomous system (AS) name of proxy's IP address or domain name.|
40
- |get_last_seen|Return the last seen days ago value of proxy's IP address or domain name.|
41
- |get_threat|Return the threat types reported to proxy's IP address or domain name. Please see [Threat Type](#threat-type) for details.|
42
-
43
- ## Usage
44
-
45
- ```
46
- require 'ip2proxy_ruby'
47
-
48
- # open IP2Proxy BIN database for proxy lookup
49
- i2p = Ip2proxy.new.open("./data/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP-DOMAIN-USAGETYPE-ASN-LASTSEEN-THREAT-RESIDENTIAL.BIN")
50
-
51
- # get versioning information
52
- print 'Module Version: ' + i2p.get_module_version + "\n"
53
- print 'Package Version: ' + i2p.get_package_version + "\n"
54
- print 'Database Version: ' + i2p.get_database_version + "\n"
55
-
56
- # individual proxy data check
57
- print 'Is Proxy: ' + i2p.is_proxy('1.2.3.4').to_s + "\n"
58
- print 'Proxy Type: ' + i2p.get_proxytype('1.2.3.4') + "\n"
59
- print 'Country Code: ' + i2p.get_country_short('1.2.3.4') + "\n"
60
- print 'Country Name: ' + i2p.get_country_long('1.2.3.4') + "\n"
61
- print 'Region Name: ' + i2p.get_region('1.2.3.4') + "\n"
62
- print 'City Name: ' + i2p.get_city('1.2.3.4') + "\n"
63
- print 'ISP: ' + i2p.get_isp('1.2.3.4') + "\n"
64
- print 'Domain: ' + i2p.get_domain('1.2.3.4') + "\n"
65
- print 'Usage Type: ' + i2p.get_usagetype('1.2.3.4') + "\n"
66
- print 'ASN: ' + i2p.get_asn('1.2.3.4') + "\n"
67
- print 'AS: ' + i2p.get_as('1.2.3.4') + "\n"
68
- print 'Last Seen: ' + i2p.get_last_seen('1.2.3.4') + "\n"
69
- print 'Threat: ' + i2p.get_threat('1.2.3.4') + "\n"
70
-
71
- # single function to get all proxy data returned in array
72
- record = i2p.get_all('1.2.3.4')
73
- print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
74
- print 'Proxy Type: ' + record['proxy_type'] + "\n"
75
- print 'Country Code: ' + record['country_short'] + "\n"
76
- print 'Country Name: ' + record['country_long'] + "\n"
77
- print 'Region Name: ' + record['region'] + "\n"
78
- print 'City Name: ' + record['city'] + "\n"
79
- print 'ISP: ' + record['isp'] + "\n"
80
- print 'Domain: ' + record['domain'] + "\n"
81
- print 'Usage Type: ' + record['usagetype'] + "\n"
82
- print 'ASN: ' + record['asn'] + "\n"
83
- print 'AS: ' + record['as'] + "\n"
84
- print 'Last Seen: ' + record['last_seen'] + "\n"
85
- print 'Threat: ' + record['threat'] + "\n"
86
-
87
- # close IP2Proxy BIN database
88
- i2p.close()
89
- ```
90
-
91
- ### Proxy Type
92
-
93
- |Proxy Type|Description|
94
- |---|---|
95
- |VPN|Anonymizing VPN services|
96
- |TOR|Tor Exit Nodes|
97
- |PUB|Public Proxies|
98
- |WEB|Web Proxies|
99
- |DCH|Hosting Providers/Data Center|
100
- |SES|Search Engine Robots|
101
- |RES|Residential Proxies [PX10+]|
102
-
103
- ### Usage Type
104
-
105
- |Usage Type|Description|
106
- |---|---|
107
- |COM|Commercial|
108
- |ORG|Organization|
109
- |GOV|Government|
110
- |MIL|Military|
111
- |EDU|University/College/School|
112
- |LIB|Library|
113
- |CDN|Content Delivery Network|
114
- |ISP|Fixed Line ISP|
115
- |MOB|Mobile ISP|
116
- |DCH|Data Center/Web Hosting/Transit|
117
- |SES|Search Engine Spider|
118
- |RSV|Reserved|
119
-
120
- ### Threat Type
121
-
122
- |Threat Type|Description|
123
- |---|---|
124
- |SPAM|Spammer|
125
- |SCANNER|Security Scanner or Attack|
126
- |BOTNET|Spyware or Malware|
127
-
128
- ## Support
129
-
130
- Email: support@ip2location.com
131
- URL: [https://www.ip2location.com](https://www.ip2location.com)
1
+ [![Latest Stable Version](https://img.shields.io/gem/v/ip2proxy_ruby.svg)](https://rubygems.org/gems/ip2proxy_ruby)
2
+ [![Total Downloads](https://img.shields.io/gem/dt/ip2proxy_ruby.svg)](https://rubygems.org/gems/ip2proxy_ruby)
3
+
4
+ # IP2Proxy Ruby Library
5
+ This module 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 and residential proxies 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 or web service.
6
+
7
+ For more details, please visit:
8
+ [https://www.ip2location.com/ip2proxy/developers/ruby](https://www.ip2location.com/ip2proxy/developers/ruby)
9
+
10
+ # Usage
11
+ You can check the **example.rb** file to learn more about usage.
12
+
13
+ ## BIN Database
14
+ An outdated BIN database was provided in the library for your testing. You are recommended to visit the [links](#dependencies) to download the latest BIN database and save it in the ```rb``` folder.
15
+
16
+ Below is the description of the functions available in the **BIN Database** lookup.
17
+
18
+ |Method Name|Description|
19
+ |---|---|
20
+ |open|Open the IP2Proxy BIN data with **File I/O** mode for lookup.|
21
+ |close|Close and clean up the file pointer.|
22
+ |get_package_version|Get the package version (1 to 11 for PX1 to PX11 respectively).|
23
+ |get_module_version|Get the module version.|
24
+ |get_database_version|Get the database version.|
25
+ |is_proxy|Check whether if an IP address was a proxy. Please see [Proxy Type](#proxy-type) for details. 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>|
26
+ |get_all|Return the proxy information in array.|
27
+ |get_proxytype|Return the proxy type. Please visit <a href="https://www.ip2location.com/database/px11-ip-proxytype-country-region-city-isp-domain-usagetype-asn-lastseen-threat-residential-provider" target="_blank">IP2Location</a> for the list of proxy types supported|
28
+ |get_country_short|Return the ISO3166-1 country code (2-digits) of the proxy.|
29
+ |get_country_long|Return the ISO3166-1 country name of the proxy.|
30
+ |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|
31
+ |get_city|Return the city name of the proxy.|
32
+ |get_isp|Return the ISP name of the proxy.|
33
+ |get_domain|Return the domain name of proxy's IP address or domain name.|
34
+ |get_usagetype|Return the ISP's usage type of proxy's IP address or domain name. Please see [Usage Type](#usage-type) for details.|
35
+ |get_asn|Return the autonomous system number (ASN) of proxy's IP address or domain name.|
36
+ |get_as|Return the autonomous system (AS) name of proxy's IP address or domain name.|
37
+ |get_last_seen|Return the last seen days ago value of proxy's IP address or domain name.|
38
+ |get_threat|Return the threat types reported to proxy's IP address or domain name. Please see [Threat Type](#threat-type) for details.|
39
+ |get_provider|Returns the VPN service provider name if available.|
40
+
41
+ ## Web Service
42
+ Below is the description of the functions available in the **Web Service** lookup.
43
+
44
+ | Function Name | Description |
45
+ |---|---|
46
+ | Constructor | Expect 3 input parameters:<ol><li>IP2Proxy API Key.</li><li>Package (PX1 - PX11)</li></li><li>Use HTTPS or HTTP</li></ol> |
47
+ | lookup | Return the proxy information in array.<ul><li>countryCode</li><li>countryName</li><li>regionName</li><li>cityName</li><li>isp</li><li>domain</li><li>usageType</li><li>asn</li><li>as</li><li>lastSeen</li><li>threat</li><li>proxyType</li><li>isProxy</li><li>provider</li><ul> |
48
+ | get_credit | Return remaining credit of the web service account. |
49
+
50
+ ### Proxy Type
51
+
52
+ |Proxy Type|Description|
53
+ |---|---|
54
+ |VPN|Anonymizing VPN services|
55
+ |TOR|Tor Exit Nodes|
56
+ |PUB|Public Proxies|
57
+ |WEB|Web Proxies|
58
+ |DCH|Hosting Providers/Data Center|
59
+ |SES|Search Engine Robots|
60
+ |RES|Residential Proxies [PX10+]|
61
+
62
+ ### Usage Type
63
+
64
+ |Usage Type|Description|
65
+ |---|---|
66
+ |COM|Commercial|
67
+ |ORG|Organization|
68
+ |GOV|Government|
69
+ |MIL|Military|
70
+ |EDU|University/College/School|
71
+ |LIB|Library|
72
+ |CDN|Content Delivery Network|
73
+ |ISP|Fixed Line ISP|
74
+ |MOB|Mobile ISP|
75
+ |DCH|Data Center/Web Hosting/Transit|
76
+ |SES|Search Engine Spider|
77
+ |RSV|Reserved|
78
+
79
+ ### Threat Type
80
+
81
+ |Threat Type|Description|
82
+ |---|---|
83
+ |SPAM|Spammer|
84
+ |SCANNER|Security Scanner or Attack|
85
+ |BOTNET|Spyware or Malware|
86
+
87
+ # Dependencies
88
+
89
+ This library requires IP2Proxy BIN data file to function. You may download the BIN data file at
90
+ * IP2Proxy LITE BIN Data (Free): https://lite.ip2location.com
91
+ * IP2Proxy Commercial BIN Data (Comprehensive): https://www.ip2location.com/proxy-database
92
+
93
+ You can also sign up for [IP2Proxy Web Service](https://www.ip2location.com/web-service/ip2proxy) to lookup by IP2Proxy API.
94
+
95
+ # Support
96
+
97
+ Email: support@ip2location.com
98
+ URL: [https://www.ip2location.com](https://www.ip2location.com)
data/example.rb CHANGED
@@ -1,43 +1,52 @@
1
- require 'ip2proxy_ruby'
2
-
3
- # open IP2Proxy BIN database for proxy lookup
4
- i2p = Ip2proxy.new.open("./data/IP2PROXY-LITE-PX1.BIN")
5
-
6
- # get versioning information
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
-
11
- # individual proxy data check
12
- print 'Is Proxy: ' + i2p.is_proxy('1.2.3.4').to_s + "\n"
13
- print 'Proxy Type: ' + i2p.get_proxytype('1.2.3.4') + "\n"
14
- print 'Country Code: ' + i2p.get_country_short('1.2.3.4') + "\n"
15
- print 'Country Name: ' + i2p.get_country_long('1.2.3.4') + "\n"
16
- print 'Region Name: ' + i2p.get_region('1.2.3.4') + "\n"
17
- print 'City Name: ' + i2p.get_city('1.2.3.4') + "\n"
18
- print 'ISP: ' + i2p.get_isp('1.2.3.4') + "\n"
19
- print 'Domain: ' + i2p.get_domain('1.2.3.4') + "\n"
20
- print 'Usage Type: ' + i2p.get_usagetype('1.2.3.4') + "\n"
21
- print 'ASN: ' + i2p.get_asn('1.2.3.4') + "\n"
22
- print 'AS: ' + i2p.get_as('1.2.3.4') + "\n"
23
- print 'Last Seen: ' + i2p.get_last_seen('1.2.3.4') + "\n"
24
- print 'Threat: ' + i2p.get_threat('1.2.3.4') + "\n"
25
-
26
- # single function to get all proxy data returned in array
27
- record = i2p.get_all('1.2.3.4')
28
- print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
29
- print 'Proxy Type: ' + record['proxy_type'] + "\n"
30
- print 'Country Code: ' + record['country_short'] + "\n"
31
- print 'Country Name: ' + record['country_long'] + "\n"
32
- print 'Region Name: ' + record['region'] + "\n"
33
- print 'City Name: ' + record['city'] + "\n"
34
- print 'ISP: ' + record['isp'] + "\n"
35
- print 'Domain: ' + record['domain'] + "\n"
36
- print 'Usage Type: ' + record['usagetype'] + "\n"
37
- print 'ASN: ' + record['asn'] + "\n"
38
- print 'AS: ' + record['as'] + "\n"
39
- print 'Last Seen: ' + record['last_seen'] + "\n"
40
- print 'Threat: ' + record['threat'] + "\n"
41
-
42
- # close IP2Proxy BIN database
43
- i2p.close()
1
+ require 'ip2proxy_ruby'
2
+
3
+ # open IP2Proxy BIN database for proxy lookup
4
+ i2p = Ip2proxy.new.open("./data/PX11.SAMPLE.BIN")
5
+
6
+ # get versioning information
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
+
11
+ # individual proxy data check
12
+ print 'Is Proxy: ' + i2p.is_proxy('1.2.3.4').to_s + "\n"
13
+ print 'Proxy Type: ' + i2p.get_proxytype('1.2.3.4') + "\n"
14
+ print 'Country Code: ' + i2p.get_country_short('1.2.3.4') + "\n"
15
+ print 'Country Name: ' + i2p.get_country_long('1.2.3.4') + "\n"
16
+ print 'Region Name: ' + i2p.get_region('1.2.3.4') + "\n"
17
+ print 'City Name: ' + i2p.get_city('1.2.3.4') + "\n"
18
+ print 'ISP: ' + i2p.get_isp('1.2.3.4') + "\n"
19
+ print 'Domain: ' + i2p.get_domain('1.2.3.4') + "\n"
20
+ print 'Usage Type: ' + i2p.get_usagetype('1.2.3.4') + "\n"
21
+ print 'ASN: ' + i2p.get_asn('1.2.3.4') + "\n"
22
+ print 'AS: ' + i2p.get_as('1.2.3.4') + "\n"
23
+ print 'Last Seen: ' + i2p.get_last_seen('1.2.3.4') + "\n"
24
+ print 'Threat: ' + i2p.get_threat('1.2.3.4') + "\n"
25
+ print 'Provider: ' + i2p.get_provider('1.2.3.4') + "\n"
26
+
27
+ # single function to get all proxy data returned in array
28
+ record = i2p.get_all('1.2.3.4')
29
+ print 'is Proxy: ' + record['is_proxy'].to_s + "\n"
30
+ print 'Proxy Type: ' + record['proxy_type'] + "\n"
31
+ print 'Country Code: ' + record['country_short'] + "\n"
32
+ print 'Country Name: ' + record['country_long'] + "\n"
33
+ print 'Region Name: ' + record['region'] + "\n"
34
+ print 'City Name: ' + record['city'] + "\n"
35
+ print 'ISP: ' + record['isp'] + "\n"
36
+ print 'Domain: ' + record['domain'] + "\n"
37
+ print 'Usage Type: ' + record['usagetype'] + "\n"
38
+ print 'ASN: ' + record['asn'] + "\n"
39
+ print 'AS: ' + record['as'] + "\n"
40
+ print 'Last Seen: ' + record['last_seen'] + "\n"
41
+ print 'Threat: ' + record['threat'] + "\n"
42
+ print 'Provider: ' + record['provider'] + "\n"
43
+
44
+ # close IP2Proxy BIN database
45
+ i2p.close()
46
+
47
+ # Web Service
48
+ ws = Ip2proxyWebService.new('demo', 'PX11', true)
49
+ record = ws.lookup('1.2.3.4')
50
+ print record
51
+ print "\n"
52
+ print ws.get_credit()
@@ -2,12 +2,12 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "ip2proxy_ruby"
5
- s.version = "3.0.0"
5
+ s.version = "3.2.1"
6
6
  s.authors = ["ip2location"]
7
7
  s.email = ["support@ip2location.com"]
8
8
 
9
9
  s.summary = "IP2Proxy Ruby library"
10
- s.description = "The official IP2Proxy Ruby library to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges and residential proxies using IP2Proxy BIN database. Other information available includes proxy type, country, state, city, ISP, domain name, usage type, AS number, AS name, threats and last seen date."
10
+ s.description = "The official IP2Proxy Ruby library to detect VPN servers, open proxies, web proxies, Tor exit nodes, search engine robots, data center ranges and residential proxies 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."
11
11
  s.homepage = "https://github.com/ip2location/ip2proxy-ruby"
12
12
  s.licenses = ["MIT"]
13
13
  s.require_paths = ["lib"]
@@ -31,10 +31,10 @@ Gem::Specification.new do |s|
31
31
  "lib/ip2proxy_ruby/i2p_string_data.rb",
32
32
  "lib/ip2proxy_ruby/ip2proxy_config.rb",
33
33
  "lib/ip2proxy_ruby/ip2proxy_record.rb",
34
- "spec/assets/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN",
35
- "spec/ip2proxy_ruby_spec.rb",
34
+ "spec/assets/PX11.SAMPLE.BIN",
35
+ "spec/ip2proxy_ruby_database_spec.rb",
36
36
  "spec/spec_helper.rb",
37
- "rb/data/IP2PROXY-LITE-PX1.BIN"
37
+ "rb/data/PX11.SAMPLE.BIN"
38
38
  ]
39
39
 
40
40
  if s.respond_to?(:metadata=)
@@ -50,25 +50,19 @@ Gem::Specification.new do |s|
50
50
 
51
51
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
52
52
  s.add_runtime_dependency(%q<bindata>, [">= 0"])
53
- s.add_development_dependency(%q<awesome_print>, [">= 0"])
54
53
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
55
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
54
+ s.add_development_dependency(%q<rdoc>, [">= 6.3.1"])
56
55
  s.add_development_dependency(%q<bundler>, [">= 1.2.0"])
57
- s.add_development_dependency(%q<simplecov>, [">= 0"])
58
56
  else
59
57
  s.add_dependency(%q<bindata>, [">= 0"])
60
- s.add_dependency(%q<awesome_print>, [">= 0"])
61
58
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
62
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
59
+ s.add_dependency(%q<rdoc>, [">= 6.3.1"])
63
60
  s.add_dependency(%q<bundler>, [">= 1.2.0"])
64
- s.add_dependency(%q<simplecov>, [">= 0"])
65
61
  end
66
62
  else
67
63
  s.add_dependency(%q<bindata>, [">= 0"])
68
- s.add_dependency(%q<awesome_print>, [">= 0"])
69
64
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
70
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
65
+ s.add_dependency(%q<rdoc>, [">= 6.3.1"])
71
66
  s.add_dependency(%q<bundler>, [">= 1.2.0"])
72
- s.add_dependency(%q<simplecov>, [">= 0"])
73
67
  end
74
68
  end
@@ -1,27 +1,28 @@
1
- class I2pDbConfig
2
- COLUMNS = {
3
- :COUNTRY => [0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3],
4
- :REGION => [0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4],
5
- :CITY => [0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5],
6
- :ISP => [0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6],
7
- :PROXYTYPE => [0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2],
8
- :DOMAIN => [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7],
9
- :USAGETYPE => [0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8],
10
- :ASN => [0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9],
11
- :AS => [0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10],
12
- :LASTSEEN => [0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11],
13
- :THREAT => [0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12]
14
- }
15
-
16
- def self.setup_database(db_index)
17
- # strip all 0 value & downcase keys
18
- cols = COLUMNS.inject({}) {|memo, (key, value)|
19
- (memo[key.to_s.downcase.to_sym] = value[db_index] if value[db_index] > 0)
20
- memo
21
- }
22
- # order by value
23
- col_array = cols.sort_by {|key,value| value}
24
- end
25
-
26
- end
1
+ class I2pDbConfig
2
+ COLUMNS = {
3
+ :COUNTRY => [0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
4
+ :REGION => [0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4],
5
+ :CITY => [0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5],
6
+ :ISP => [0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6],
7
+ :PROXYTYPE => [0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
8
+ :DOMAIN => [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7],
9
+ :USAGETYPE => [0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8],
10
+ :ASN => [0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9],
11
+ :AS => [0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10],
12
+ :LASTSEEN => [0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11],
13
+ :THREAT => [0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12],
14
+ :PROVIDER => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13]
15
+ }
16
+
17
+ def self.setup_database(db_index)
18
+ # strip all 0 value & downcase keys
19
+ cols = COLUMNS.inject({}) {|memo, (key, value)|
20
+ (memo[key.to_s.downcase.to_sym] = value[db_index] if value[db_index] > 0)
21
+ memo
22
+ }
23
+ # order by value
24
+ col_array = cols.sort_by {|key,value| value}
25
+ end
26
+
27
+ end
27
28
 
@@ -1,10 +1,10 @@
1
- class I2pIpData < BinData::BasePrimitive
2
- def read_and_return_value(io)
3
- iv = eval_parameter(:ip_version)
4
- if iv == 4
5
- addr = BinData::Uint32le.read(io)
6
- elsif iv == 6
7
- addr = BinData::Uint128le.read(io)
8
- end
9
- end
1
+ class I2pIpData < BinData::BasePrimitive
2
+ def read_and_return_value(io)
3
+ iv = eval_parameter(:ip_version)
4
+ if iv == 4
5
+ addr = BinData::Uint32le.read(io)
6
+ elsif iv == 6
7
+ addr = BinData::Uint128le.read(io)
8
+ end
9
+ end
10
10
  end
@@ -1,16 +1,16 @@
1
- class I2pStringData < BinData::BasePrimitive
2
-
3
- def read_and_return_value(io)
4
- country_long = eval_parameter(:country_long)
5
- io.seekbytes(-4) if country_long
6
- file = io.instance_variable_get('@raw_io')
7
- addr = BinData::Uint32le.read(io)
8
- old_offset = file.tell
9
- country_long ? file.seek(addr + 3) : file.seek(addr)
10
- length = BinData::Uint8.read(file)
11
- res = BinData::String.new(:length => length).read(file)
12
- file.seek(old_offset)
13
- res
14
- end
15
-
1
+ class I2pStringData < BinData::BasePrimitive
2
+
3
+ def read_and_return_value(io)
4
+ country_long = eval_parameter(:country_long)
5
+ io.seekbytes(-4) if country_long
6
+ file = io.instance_variable_get('@raw_io')
7
+ addr = BinData::Uint32le.read(io)
8
+ old_offset = file.tell
9
+ country_long ? file.seek(addr + 3) : file.seek(addr)
10
+ length = BinData::Uint8.read(file)
11
+ res = BinData::String.new(:length => length).read(file)
12
+ file.seek(old_offset)
13
+ res
14
+ end
15
+
16
16
  end
@@ -1,17 +1,20 @@
1
- class Ip2proxyConfig < BinData::Record
2
- endian :little
3
- uint8 :databasetype
4
- uint8 :databasecolumn
5
- uint8 :databaseyear
6
- uint8 :databasemonth
7
- uint8 :databaseday
8
- # uint32 :databasecount
9
- # uint32 :databaseaddr
10
- # uint32 :ipversion
11
- uint32 :ipv4databasecount
12
- uint32 :ipv4databaseaddr
13
- uint32 :ipv6databasecount
14
- uint32 :ipv6databaseaddr
15
- uint32 :ipv4indexbaseaddr
16
- uint32 :ipv6indexbaseaddr
1
+ class Ip2proxyConfig < BinData::Record
2
+ endian :little
3
+ uint8 :databasetype
4
+ uint8 :databasecolumn
5
+ uint8 :databaseyear
6
+ uint8 :databasemonth
7
+ uint8 :databaseday
8
+ # uint32 :databasecount
9
+ # uint32 :databaseaddr
10
+ # uint32 :ipversion
11
+ uint32 :ipv4databasecount
12
+ uint32 :ipv4databaseaddr
13
+ uint32 :ipv6databasecount
14
+ uint32 :ipv6databaseaddr
15
+ uint32 :ipv4indexbaseaddr
16
+ uint32 :ipv6indexbaseaddr
17
+ uint8 :productcode
18
+ uint8 :licensecode
19
+ uint32 :databasesize
17
20
  end
@@ -1,20 +1,20 @@
1
- class Ip2ProxyRecord
2
- def self.init(database, ip_version)
3
- cls = Class.new(BinData::Record)
4
- cls.class_eval {
5
- endian :little
6
- i2p_ip_data :ip_from, :ip_version => ip_version
7
- database.each do |col|
8
- if col.first == :country
9
- i2p_string_data :country_short
10
- i2p_string_data :country_long, :country_long => true
11
- else
12
- i2p_string_data col.first
13
- end
14
- end
15
-
16
- i2p_ip_data :ip_to, :ip_version => ip_version
17
- }
18
- cls
19
- end
1
+ class Ip2ProxyRecord
2
+ def self.init(database, ip_version)
3
+ cls = Class.new(BinData::Record)
4
+ cls.class_eval {
5
+ endian :little
6
+ i2p_ip_data :ip_from, :ip_version => ip_version
7
+ database.each do |col|
8
+ if col.first == :country
9
+ i2p_string_data :country_short
10
+ i2p_string_data :country_long, :country_long => true
11
+ else
12
+ i2p_string_data col.first
13
+ end
14
+ end
15
+
16
+ i2p_ip_data :ip_to, :ip_version => ip_version
17
+ }
18
+ cls
19
+ end
20
20
  end