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 +4 -4
- data/LICENSE.txt +20 -20
- data/README.md +98 -131
- data/example.rb +52 -43
- data/ip2proxy_ruby.gemspec +8 -14
- data/lib/ip2proxy_ruby/i2p_database_config.rb +27 -26
- data/lib/ip2proxy_ruby/i2p_ip_data.rb +9 -9
- data/lib/ip2proxy_ruby/i2p_string_data.rb +15 -15
- data/lib/ip2proxy_ruby/ip2proxy_config.rb +19 -16
- data/lib/ip2proxy_ruby/ip2proxy_record.rb +19 -19
- data/lib/ip2proxy_ruby.rb +524 -427
- data/rb/data/PX11.SAMPLE.BIN +0 -0
- data/spec/assets/PX11.SAMPLE.BIN +0 -0
- data/spec/ip2proxy_ruby_database_spec.rb +123 -0
- data/spec/spec_helper.rb +0 -1
- metadata +11 -39
- data/rb/data/IP2PROXY-LITE-PX1.BIN +0 -0
- data/spec/assets/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN +0 -0
- data/spec/ip2proxy_ruby_spec.rb +0 -20
Binary file
|
Binary file
|
@@ -0,0 +1,123 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "Ip2proxy" do
|
4
|
+
it "work correctly with invalid ip" do
|
5
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
6
|
+
record = i2p.get_all('1.0.0.x')
|
7
|
+
expect(record['country_short']).to eq 'INVALID IP ADDRESS'
|
8
|
+
end
|
9
|
+
|
10
|
+
it "work correctly with get_all ipv4" do
|
11
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
12
|
+
record = i2p.get_all('1.0.0.8')
|
13
|
+
expect(record['country_short']).to eq 'US'
|
14
|
+
end
|
15
|
+
|
16
|
+
it "work correctly with get_country_short" do
|
17
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
18
|
+
record = i2p.get_country_short('1.0.0.8')
|
19
|
+
expect(record).to eq 'US'
|
20
|
+
end
|
21
|
+
|
22
|
+
it "work correctly with get_country_long" do
|
23
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
24
|
+
record = i2p.get_country_long('1.0.0.8')
|
25
|
+
expect(record).to eq 'United States of America'
|
26
|
+
end
|
27
|
+
|
28
|
+
it "work correctly with get_region" do
|
29
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
30
|
+
record = i2p.get_region('1.0.0.8')
|
31
|
+
expect(record).to eq 'California'
|
32
|
+
end
|
33
|
+
|
34
|
+
it "work correctly with get_city" do
|
35
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
36
|
+
record = i2p.get_city('1.0.0.8')
|
37
|
+
expect(record).to eq 'Los Angeles'
|
38
|
+
end
|
39
|
+
|
40
|
+
it "work correctly with get_isp" do
|
41
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
42
|
+
record = i2p.get_isp('1.0.0.8')
|
43
|
+
expect(record).to eq 'APNIC and CloudFlare DNS Resolver Project'
|
44
|
+
end
|
45
|
+
|
46
|
+
it "work correctly with get_domain" do
|
47
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
48
|
+
record = i2p.get_domain('1.0.0.8')
|
49
|
+
expect(record).to eq 'cloudflare.com'
|
50
|
+
end
|
51
|
+
|
52
|
+
it "work correctly with get_usagetype" do
|
53
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
54
|
+
record = i2p.get_usagetype('1.0.0.8')
|
55
|
+
expect(record).to eq 'CDN'
|
56
|
+
end
|
57
|
+
|
58
|
+
it "work correctly with get_asn" do
|
59
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
60
|
+
record = i2p.get_asn('1.0.0.8')
|
61
|
+
expect(record).to eq '13335'
|
62
|
+
end
|
63
|
+
|
64
|
+
it "work correctly with get_as" do
|
65
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
66
|
+
record = i2p.get_as('1.0.0.8')
|
67
|
+
expect(record).to eq 'CLOUDFLARENET'
|
68
|
+
end
|
69
|
+
|
70
|
+
it "work correctly with get_last_seen" do
|
71
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
72
|
+
record = i2p.get_last_seen('1.0.0.8')
|
73
|
+
expect(record).to eq '22'
|
74
|
+
end
|
75
|
+
|
76
|
+
it "work correctly with get_threat" do
|
77
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
78
|
+
record = i2p.get_threat('1.0.0.8')
|
79
|
+
expect(record).to eq '-'
|
80
|
+
end
|
81
|
+
|
82
|
+
it "work correctly with is_proxy" do
|
83
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
84
|
+
record = i2p.is_proxy('1.0.0.8')
|
85
|
+
expect(record).to eq 2
|
86
|
+
end
|
87
|
+
|
88
|
+
it "work correctly with get_proxytype" do
|
89
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
90
|
+
record = i2p.get_proxytype('1.0.0.8')
|
91
|
+
expect(record).to eq 'DCH'
|
92
|
+
end
|
93
|
+
|
94
|
+
it "work correctly with get_provider" do
|
95
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
96
|
+
record = i2p.get_provider('1.0.0.8')
|
97
|
+
expect(record).to eq 'CloudFlare'
|
98
|
+
end
|
99
|
+
|
100
|
+
it "work correctly with get_all ipv6" do
|
101
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
102
|
+
record = i2p.get_all('2c0f:ffa0::4')
|
103
|
+
expect(record['country_short']).to eq 'UG'
|
104
|
+
end
|
105
|
+
|
106
|
+
it "work correctly with get_module_version" do
|
107
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
108
|
+
record = i2p.get_module_version()
|
109
|
+
expect(record).to eq '3.2.1'
|
110
|
+
end
|
111
|
+
|
112
|
+
it "work correctly with get_package_version" do
|
113
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
114
|
+
record = i2p.get_package_version()
|
115
|
+
expect(record).to eq '11'
|
116
|
+
end
|
117
|
+
|
118
|
+
it "work correctly with get_database_version" do
|
119
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX11.SAMPLE.BIN")
|
120
|
+
record = i2p.get_database_version()
|
121
|
+
expect(record).to eq '2021.5.28'
|
122
|
+
end
|
123
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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: 3.
|
4
|
+
version: 3.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ip2location
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bindata
|
@@ -24,20 +24,6 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: awesome_print
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: rspec
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -56,16 +42,16 @@ dependencies:
|
|
56
42
|
name: rdoc
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- - "
|
45
|
+
- - ">="
|
60
46
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
47
|
+
version: 6.3.1
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- - "
|
52
|
+
- - ">="
|
67
53
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
54
|
+
version: 6.3.1
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: bundler
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,25 +66,11 @@ dependencies:
|
|
80
66
|
- - ">="
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: 1.2.0
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: simplecov
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
69
|
description: The official IP2Proxy Ruby library to detect VPN servers, open proxies,
|
98
70
|
web proxies, Tor exit nodes, search engine robots, data center ranges and residential
|
99
71
|
proxies using IP2Proxy BIN database. Other information available includes proxy
|
100
|
-
type, country, state, city, ISP, domain name, usage type, AS number, AS name, threats
|
101
|
-
|
72
|
+
type, country, state, city, ISP, domain name, usage type, AS number, AS name, threats,
|
73
|
+
last seen date and provider names.
|
102
74
|
email:
|
103
75
|
- support@ip2location.com
|
104
76
|
executables: []
|
@@ -121,9 +93,9 @@ files:
|
|
121
93
|
- lib/ip2proxy_ruby/i2p_string_data.rb
|
122
94
|
- lib/ip2proxy_ruby/ip2proxy_config.rb
|
123
95
|
- lib/ip2proxy_ruby/ip2proxy_record.rb
|
124
|
-
- rb/data/
|
125
|
-
- spec/assets/
|
126
|
-
- spec/
|
96
|
+
- rb/data/PX11.SAMPLE.BIN
|
97
|
+
- spec/assets/PX11.SAMPLE.BIN
|
98
|
+
- spec/ip2proxy_ruby_database_spec.rb
|
127
99
|
- spec/spec_helper.rb
|
128
100
|
homepage: https://github.com/ip2location/ip2proxy-ruby
|
129
101
|
licenses:
|
Binary file
|
Binary file
|
data/spec/ip2proxy_ruby_spec.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe "Ip2proxy" do
|
4
|
-
it "work correctly with ipv4" do
|
5
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
|
6
|
-
record = i2p.get_all('1.0.241.135')
|
7
|
-
record.should_not be_nil
|
8
|
-
record['is_proxy'].should == 1
|
9
|
-
i2p.close()
|
10
|
-
end
|
11
|
-
|
12
|
-
it "work correctly with ipv6" do
|
13
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/IP2PROXY-IP-PROXYTYPE-COUNTRY-REGION-CITY-ISP.SAMPLE.BIN")
|
14
|
-
record = i2p.get_all('2001::')
|
15
|
-
record.should_not be_nil
|
16
|
-
record['is_proxy'].should == 0
|
17
|
-
i2p.close()
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|