ip2proxy_ruby 3.3.1 → 3.5.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 +4 -4
- data/LICENSE.txt +1 -1
- data/README.md +5 -2
- data/example.rb +46 -44
- data/ip2proxy_ruby.gemspec +4 -3
- data/lib/ip2proxy_ruby/i2p_database_config.rb +13 -12
- data/lib/ip2proxy_ruby.rb +545 -526
- data/rb/data/PX12.SAMPLE.BIN +0 -0
- data/spec/assets/PX12.SAMPLE.BIN +0 -0
- data/spec/ip2proxy_ruby_database_spec.rb +44 -38
- metadata +6 -8
- data/rb/data/PX11.SAMPLE.BIN +0 -0
- data/spec/assets/PX11.SAMPLE.BIN +0 -0
|
Binary file
|
|
Binary file
|
|
@@ -2,122 +2,128 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
|
|
2
2
|
|
|
3
3
|
describe "Ip2proxy" do
|
|
4
4
|
it "work correctly with invalid ip" do
|
|
5
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
5
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
6
6
|
record = i2p.get_all('1.0.0.x')
|
|
7
7
|
expect(record['country_short']).to eq 'INVALID IP ADDRESS'
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
it "work correctly with get_all ipv4" do
|
|
11
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
11
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
12
12
|
record = i2p.get_all('1.0.0.8')
|
|
13
|
-
expect(record['country_short']).to eq '
|
|
13
|
+
expect(record['country_short']).to eq '-'
|
|
14
14
|
end
|
|
15
15
|
|
|
16
16
|
it "work correctly with get_country_short" do
|
|
17
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
17
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
18
18
|
record = i2p.get_country_short('1.0.0.8')
|
|
19
|
-
expect(record).to eq '
|
|
19
|
+
expect(record).to eq '-'
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
it "work correctly with get_country_long" do
|
|
23
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
23
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
24
24
|
record = i2p.get_country_long('1.0.0.8')
|
|
25
|
-
expect(record).to eq '
|
|
25
|
+
expect(record).to eq '-'
|
|
26
26
|
end
|
|
27
27
|
|
|
28
28
|
it "work correctly with get_region" do
|
|
29
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
29
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
30
30
|
record = i2p.get_region('1.0.0.8')
|
|
31
|
-
expect(record).to eq '
|
|
31
|
+
expect(record).to eq '-'
|
|
32
32
|
end
|
|
33
33
|
|
|
34
34
|
it "work correctly with get_city" do
|
|
35
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
35
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
36
36
|
record = i2p.get_city('1.0.0.8')
|
|
37
|
-
expect(record).to eq '
|
|
37
|
+
expect(record).to eq '-'
|
|
38
38
|
end
|
|
39
39
|
|
|
40
40
|
it "work correctly with get_isp" do
|
|
41
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
41
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
42
42
|
record = i2p.get_isp('1.0.0.8')
|
|
43
|
-
expect(record).to eq '
|
|
43
|
+
expect(record).to eq '-'
|
|
44
44
|
end
|
|
45
45
|
|
|
46
46
|
it "work correctly with get_domain" do
|
|
47
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
47
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
48
48
|
record = i2p.get_domain('1.0.0.8')
|
|
49
|
-
expect(record).to eq '
|
|
49
|
+
expect(record).to eq '-'
|
|
50
50
|
end
|
|
51
51
|
|
|
52
52
|
it "work correctly with get_usagetype" do
|
|
53
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
53
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
54
54
|
record = i2p.get_usagetype('1.0.0.8')
|
|
55
|
-
expect(record).to eq '
|
|
55
|
+
expect(record).to eq '-'
|
|
56
56
|
end
|
|
57
57
|
|
|
58
58
|
it "work correctly with get_asn" do
|
|
59
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
59
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
60
60
|
record = i2p.get_asn('1.0.0.8')
|
|
61
|
-
expect(record).to eq '
|
|
61
|
+
expect(record).to eq '-'
|
|
62
62
|
end
|
|
63
63
|
|
|
64
64
|
it "work correctly with get_as" do
|
|
65
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
65
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
66
66
|
record = i2p.get_as('1.0.0.8')
|
|
67
|
-
expect(record).to eq '
|
|
67
|
+
expect(record).to eq '-'
|
|
68
68
|
end
|
|
69
69
|
|
|
70
70
|
it "work correctly with get_last_seen" do
|
|
71
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
71
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
72
72
|
record = i2p.get_last_seen('1.0.0.8')
|
|
73
|
-
expect(record).to eq '
|
|
73
|
+
expect(record).to eq '-'
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it "work correctly with get_threat" do
|
|
77
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
77
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
78
78
|
record = i2p.get_threat('1.0.0.8')
|
|
79
79
|
expect(record).to eq '-'
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
it "work correctly with is_proxy" do
|
|
83
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
83
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
84
84
|
record = i2p.is_proxy('1.0.0.8')
|
|
85
|
-
expect(record).to eq
|
|
85
|
+
expect(record).to eq 0
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
it "work correctly with get_proxytype" do
|
|
89
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
89
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
90
90
|
record = i2p.get_proxytype('1.0.0.8')
|
|
91
|
-
expect(record).to eq '
|
|
91
|
+
expect(record).to eq '-'
|
|
92
92
|
end
|
|
93
93
|
|
|
94
94
|
it "work correctly with get_provider" do
|
|
95
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
95
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
96
96
|
record = i2p.get_provider('1.0.0.8')
|
|
97
|
-
expect(record).to eq '
|
|
97
|
+
expect(record).to eq '-'
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
it "work correctly with get_fraud_score" do
|
|
101
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
102
|
+
record = i2p.get_fraud_score('1.0.0.8')
|
|
103
|
+
expect(record).to eq '0'
|
|
98
104
|
end
|
|
99
105
|
|
|
100
106
|
it "work correctly with get_all ipv6" do
|
|
101
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
107
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
102
108
|
record = i2p.get_all('2c0f:ffa0::4')
|
|
103
|
-
expect(record['country_short']).to eq '
|
|
109
|
+
expect(record['country_short']).to eq '-'
|
|
104
110
|
end
|
|
105
111
|
|
|
106
112
|
it "work correctly with get_module_version" do
|
|
107
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
113
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
108
114
|
record = i2p.get_module_version()
|
|
109
|
-
expect(record).to eq '3.
|
|
115
|
+
expect(record).to eq '3.5.0'
|
|
110
116
|
end
|
|
111
117
|
|
|
112
118
|
it "work correctly with get_package_version" do
|
|
113
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
119
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
114
120
|
record = i2p.get_package_version()
|
|
115
|
-
expect(record).to eq '
|
|
121
|
+
expect(record).to eq '12'
|
|
116
122
|
end
|
|
117
123
|
|
|
118
124
|
it "work correctly with get_database_version" do
|
|
119
|
-
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/
|
|
125
|
+
i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
|
|
120
126
|
record = i2p.get_database_version()
|
|
121
|
-
expect(record).to eq '
|
|
127
|
+
expect(record).to eq '2025.2.5'
|
|
122
128
|
end
|
|
123
129
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ip2proxy_ruby
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- ip2location
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bindata
|
|
@@ -93,8 +92,8 @@ files:
|
|
|
93
92
|
- lib/ip2proxy_ruby/i2p_string_data.rb
|
|
94
93
|
- lib/ip2proxy_ruby/ip2proxy_config.rb
|
|
95
94
|
- lib/ip2proxy_ruby/ip2proxy_record.rb
|
|
96
|
-
- rb/data/
|
|
97
|
-
- spec/assets/
|
|
95
|
+
- rb/data/PX12.SAMPLE.BIN
|
|
96
|
+
- spec/assets/PX12.SAMPLE.BIN
|
|
98
97
|
- spec/ip2proxy_ruby_database_spec.rb
|
|
99
98
|
- spec/spec_helper.rb
|
|
100
99
|
homepage: https://github.com/ip2location/ip2proxy-ruby
|
|
@@ -102,9 +101,9 @@ licenses:
|
|
|
102
101
|
- MIT
|
|
103
102
|
metadata:
|
|
104
103
|
bug_tracker_uri: https://github.com/ip2location/ip2proxy-ruby/issues
|
|
104
|
+
documentation_uri: https://www.rubydoc.info/gems/ip2proxy_ruby
|
|
105
105
|
homepage_uri: https://www.ip2location.com
|
|
106
106
|
source_code_uri: https://github.com/ip2location/ip2proxy-ruby
|
|
107
|
-
post_install_message:
|
|
108
107
|
rdoc_options: []
|
|
109
108
|
require_paths:
|
|
110
109
|
- lib
|
|
@@ -119,8 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
119
118
|
- !ruby/object:Gem::Version
|
|
120
119
|
version: '0'
|
|
121
120
|
requirements: []
|
|
122
|
-
rubygems_version:
|
|
123
|
-
signing_key:
|
|
121
|
+
rubygems_version: 4.0.10
|
|
124
122
|
specification_version: 4
|
|
125
123
|
summary: IP2Proxy Ruby library
|
|
126
124
|
test_files: []
|
data/rb/data/PX11.SAMPLE.BIN
DELETED
|
Binary file
|
data/spec/assets/PX11.SAMPLE.BIN
DELETED
|
Binary file
|