ip2proxy_ruby 3.5.0 → 3.5.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4fcaf2e6a17ab015cd891c8f518ad2fe7494faf1c0392fd53d4f65b91afc0a7c
4
- data.tar.gz: 2db5fece7ac66539061f5755d91f7a71593fc5fc07aa4028e3e0e924fa946804
3
+ metadata.gz: 48e91ed1c5f7655a4cf3118f0cb2794f4aae5f391a9a2910a75e178b29a4d484
4
+ data.tar.gz: bb8d4ec7adaa8dbd44f228d7bf544c4be5d05395faabca20ea79dbbf6fe35472
5
5
  SHA512:
6
- metadata.gz: e5eb42c6941106364964185194e927068f762463a7c6e9ab360fc941886b1755bf58c9e2074c0e296769da45e713677e02093d39cba1072bbf64621d02c0abed
7
- data.tar.gz: 8d4824e9317981ad0049906c3c3d001e04f0ff810ed26a7270829a2ce73056c2838ada560eb6c9c69c969e5cd61027998577bb1588f5daf1719a71570e6bda67
6
+ metadata.gz: 263d523594651fd7b19e4064fdddf0d8869c8d369085dd1716960873f4fb05fce2d40dfb96e843cd4da22a01323eaa7822df82fea73b9a891e15177dfcc4cfcb
7
+ data.tar.gz: 1afd1cfbce8b9327c0a608c7d9bd3d220f35985579ff097936f794cf100dd81dd1e75823b580b158ce6d0309501f920c152daa525a066ebded7e2da4bcecb8c1
data/Gemfile CHANGED
@@ -2,4 +2,4 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in ip2proxy_ruby.gemspec
4
4
  gemspec
5
- gem 'bindata', "~> 2.4.15"
5
+ gem 'bindata', "~> 3.0"
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 - 2026 IP2Location ( support@ip2location.com )
1
+ Copyright (c) 2016-2026 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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "ip2proxy_ruby"
5
- s.version = "3.5.0"
5
+ s.version = "3.5.1"
6
6
  s.authors = ["ip2location"]
7
7
  s.email = ["support@ip2location.com"]
8
8
 
@@ -37,33 +37,17 @@ Gem::Specification.new do |s|
37
37
  "rb/data/PX12.SAMPLE.BIN"
38
38
  ]
39
39
 
40
- if s.respond_to?(:metadata=)
41
- s.metadata = {
42
- "bug_tracker_uri" => "https://github.com/ip2location/ip2proxy-ruby/issues",
43
- "documentation_uri" => "https://www.rubydoc.info/gems/ip2proxy_ruby",
44
- "homepage_uri" => "https://www.ip2location.com",
45
- "source_code_uri" => "https://github.com/ip2location/ip2proxy-ruby",
46
- }
47
- end
40
+ s.metadata = {
41
+ "bug_tracker_uri" => "https://github.com/ip2location/ip2proxy-ruby/issues",
42
+ "documentation_uri" => "https://www.rubydoc.info/gems/ip2proxy_ruby",
43
+ "homepage_uri" => "https://www.ip2location.com",
44
+ "source_code_uri" => "https://github.com/ip2location/ip2proxy-ruby",
45
+ }
48
46
 
49
- if s.respond_to? :specification_version then
50
- s.specification_version = 4
47
+ s.required_ruby_version = ">= 3.0"
48
+ s.add_runtime_dependency "bindata", "~> 3.0"
49
+ s.add_development_dependency "rspec", "~> 3.13"
50
+ s.add_development_dependency "rdoc", ">= 6.3.1"
51
+ s.add_development_dependency "bundler", ">= 2.4"
51
52
 
52
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
- s.add_runtime_dependency(%q<bindata>, ["~> 2.4.15"])
54
- s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
55
- s.add_development_dependency(%q<rdoc>, [">= 6.3.1"])
56
- s.add_development_dependency(%q<bundler>, [">= 1.2.0"])
57
- else
58
- s.add_dependency(%q<bindata>, ["~> 2.4.15"])
59
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
60
- s.add_dependency(%q<rdoc>, [">= 6.3.1"])
61
- s.add_dependency(%q<bundler>, [">= 1.2.0"])
62
- end
63
- else
64
- s.add_dependency(%q<bindata>, ["~> 2.4.15"])
65
- s.add_dependency(%q<rspec>, ["~> 2.8.0"])
66
- s.add_dependency(%q<rdoc>, [">= 6.3.1"])
67
- s.add_dependency(%q<bundler>, [">= 1.2.0"])
68
- end
69
53
  end
@@ -1,29 +1,29 @@
1
- class I2pDbConfig
2
- COLUMNS = {
3
- :COUNTRY => [0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
4
- :REGION => [0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
5
- :CITY => [0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],
6
- :ISP => [0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6],
7
- :PROXYTYPE => [0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
8
- :DOMAIN => [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7],
9
- :USAGETYPE => [0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8],
10
- :ASN => [0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9],
11
- :AS => [0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10],
12
- :LASTSEEN => [0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 11],
13
- :THREAT => [0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12],
14
- :PROVIDER => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 13],
15
- :FRAUD_SCORE => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14]
16
- }
17
-
18
- def self.setup_database(db_index)
19
- # strip all 0 value & downcase keys
20
- cols = COLUMNS.inject({}) {|memo, (key, value)|
21
- (memo[key.to_s.downcase.to_sym] = value[db_index] if value[db_index] > 0)
22
- memo
23
- }
24
- # order by value
25
- col_array = cols.sort_by {|key,value| value}
26
- end
27
-
28
- end
1
+ class I2pDbConfig
2
+ COLUMNS = {
3
+ :COUNTRY => [0, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3],
4
+ :REGION => [0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4],
5
+ :CITY => [0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5],
6
+ :ISP => [0, 0, 0, 0, 6, 6, 6, 6, 6, 6, 6, 6, 6],
7
+ :PROXYTYPE => [0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
8
+ :DOMAIN => [0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7],
9
+ :USAGETYPE => [0, 0, 0, 0, 0, 0, 8, 8, 8, 8, 8, 8, 8],
10
+ :ASN => [0, 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9],
11
+ :AS => [0, 0, 0, 0, 0, 0, 0, 10, 10, 10, 10, 10, 10],
12
+ :LASTSEEN => [0, 0, 0, 0, 0, 0, 0, 0, 11, 11, 11, 11, 11],
13
+ :THREAT => [0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 12, 12, 12],
14
+ :PROVIDER => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 13],
15
+ :FRAUD_SCORE => [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14]
16
+ }
17
+
18
+ def self.setup_database(db_index)
19
+ # strip all 0 value & downcase keys
20
+ cols = COLUMNS.inject({}) {|memo, (key, value)|
21
+ (memo[key.to_s.downcase.to_sym] = value[db_index] if value[db_index] > 0)
22
+ memo
23
+ }
24
+ # order by value
25
+ col_array = cols.sort_by {|key,value| value}
26
+ end
27
+
28
+ end
29
29
 
@@ -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,19 @@
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
+ def read_and_return_value(io)
3
+ country_long = eval_parameter(:country_long)
4
+ raw_io = io.instance_variable_get(:@io)
5
+ initial_pos = raw_io.instance_variable_get(:@initial_pos)
6
+ if country_long
7
+ io.seek_to_abs_offset(raw_io.offset - 4)
8
+ end
9
+ addr = BinData::Uint32le.read(io)
10
+ old_offset = raw_io.offset
11
+ string_offset = country_long ? addr + 3 : addr
12
+ relative_offset = string_offset - initial_pos
13
+ io.seek_to_abs_offset(relative_offset)
14
+ length = BinData::Uint8.read(io)
15
+ result = BinData::String.new(:length => length).read(io)
16
+ io.seek_to_abs_offset(old_offset)
17
+ result
18
+ end
16
19
  end
@@ -1,20 +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
17
- uint8 :productcode
18
- uint8 :licensecode
19
- uint32 :databasesize
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
20
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
data/lib/ip2proxy_ruby.rb CHANGED
@@ -11,7 +11,7 @@ require_relative 'ip2proxy_ruby/ip2proxy_record'
11
11
  class Ip2proxy
12
12
  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, :last_err_msg
13
13
 
14
- VERSION = '3.5.0'
14
+ VERSION = '3.5.1'
15
15
  FIELD_NOT_SUPPORTED = 'NOT SUPPORTED'
16
16
  INVALID_IP_ADDRESS = 'INVALID IP ADDRESS'
17
17
  INVALID_BIN_DATABASE = 'Incorrect IP2Proxy BIN file format. Please make sure that you are using the latest IP2Proxy BIN file.'
@@ -1,129 +1,129 @@
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/PX12.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/PX12.SAMPLE.BIN")
12
- record = i2p.get_all('1.0.0.8')
13
- expect(record['country_short']).to eq '-'
14
- end
15
-
16
- it "work correctly with get_country_short" do
17
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
18
- record = i2p.get_country_short('1.0.0.8')
19
- expect(record).to eq '-'
20
- end
21
-
22
- it "work correctly with get_country_long" do
23
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
24
- record = i2p.get_country_long('1.0.0.8')
25
- expect(record).to eq '-'
26
- end
27
-
28
- it "work correctly with get_region" do
29
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
30
- record = i2p.get_region('1.0.0.8')
31
- expect(record).to eq '-'
32
- end
33
-
34
- it "work correctly with get_city" do
35
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
36
- record = i2p.get_city('1.0.0.8')
37
- expect(record).to eq '-'
38
- end
39
-
40
- it "work correctly with get_isp" do
41
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
42
- record = i2p.get_isp('1.0.0.8')
43
- expect(record).to eq '-'
44
- end
45
-
46
- it "work correctly with get_domain" do
47
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
48
- record = i2p.get_domain('1.0.0.8')
49
- expect(record).to eq '-'
50
- end
51
-
52
- it "work correctly with get_usagetype" do
53
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
54
- record = i2p.get_usagetype('1.0.0.8')
55
- expect(record).to eq '-'
56
- end
57
-
58
- it "work correctly with get_asn" do
59
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
60
- record = i2p.get_asn('1.0.0.8')
61
- expect(record).to eq '-'
62
- end
63
-
64
- it "work correctly with get_as" do
65
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
66
- record = i2p.get_as('1.0.0.8')
67
- expect(record).to eq '-'
68
- end
69
-
70
- it "work correctly with get_last_seen" do
71
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
72
- record = i2p.get_last_seen('1.0.0.8')
73
- expect(record).to eq '-'
74
- end
75
-
76
- it "work correctly with get_threat" do
77
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.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/PX12.SAMPLE.BIN")
84
- record = i2p.is_proxy('1.0.0.8')
85
- expect(record).to eq 0
86
- end
87
-
88
- it "work correctly with get_proxytype" do
89
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
90
- record = i2p.get_proxytype('1.0.0.8')
91
- expect(record).to eq '-'
92
- end
93
-
94
- it "work correctly with get_provider" do
95
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
96
- record = i2p.get_provider('1.0.0.8')
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'
104
- end
105
-
106
- it "work correctly with get_all ipv6" do
107
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
108
- record = i2p.get_all('2c0f:ffa0::4')
109
- expect(record['country_short']).to eq '-'
110
- end
111
-
112
- it "work correctly with get_module_version" do
113
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
114
- record = i2p.get_module_version()
115
- expect(record).to eq '3.5.0'
116
- end
117
-
118
- it "work correctly with get_package_version" do
119
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
120
- record = i2p.get_package_version()
121
- expect(record).to eq '12'
122
- end
123
-
124
- it "work correctly with get_database_version" do
125
- i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
126
- record = i2p.get_database_version()
127
- expect(record).to eq '2025.2.5'
128
- end
129
- end
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/PX12.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/PX12.SAMPLE.BIN")
12
+ record = i2p.get_all('1.0.0.8')
13
+ expect(record['country_short']).to eq '-'
14
+ end
15
+
16
+ it "work correctly with get_country_short" do
17
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
18
+ record = i2p.get_country_short('1.0.0.8')
19
+ expect(record).to eq '-'
20
+ end
21
+
22
+ it "work correctly with get_country_long" do
23
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
24
+ record = i2p.get_country_long('1.0.0.8')
25
+ expect(record).to eq '-'
26
+ end
27
+
28
+ it "work correctly with get_region" do
29
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
30
+ record = i2p.get_region('1.0.0.8')
31
+ expect(record).to eq '-'
32
+ end
33
+
34
+ it "work correctly with get_city" do
35
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
36
+ record = i2p.get_city('1.0.0.8')
37
+ expect(record).to eq '-'
38
+ end
39
+
40
+ it "work correctly with get_isp" do
41
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
42
+ record = i2p.get_isp('1.0.0.8')
43
+ expect(record).to eq '-'
44
+ end
45
+
46
+ it "work correctly with get_domain" do
47
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
48
+ record = i2p.get_domain('1.0.0.8')
49
+ expect(record).to eq '-'
50
+ end
51
+
52
+ it "work correctly with get_usagetype" do
53
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
54
+ record = i2p.get_usagetype('1.0.0.8')
55
+ expect(record).to eq '-'
56
+ end
57
+
58
+ it "work correctly with get_asn" do
59
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
60
+ record = i2p.get_asn('1.0.0.8')
61
+ expect(record).to eq '-'
62
+ end
63
+
64
+ it "work correctly with get_as" do
65
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
66
+ record = i2p.get_as('1.0.0.8')
67
+ expect(record).to eq '-'
68
+ end
69
+
70
+ it "work correctly with get_last_seen" do
71
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
72
+ record = i2p.get_last_seen('1.0.0.8')
73
+ expect(record).to eq '-'
74
+ end
75
+
76
+ it "work correctly with get_threat" do
77
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.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/PX12.SAMPLE.BIN")
84
+ record = i2p.is_proxy('1.0.0.8')
85
+ expect(record).to eq 0
86
+ end
87
+
88
+ it "work correctly with get_proxytype" do
89
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
90
+ record = i2p.get_proxytype('1.0.0.8')
91
+ expect(record).to eq '-'
92
+ end
93
+
94
+ it "work correctly with get_provider" do
95
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
96
+ record = i2p.get_provider('1.0.0.8')
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'
104
+ end
105
+
106
+ it "work correctly with get_all ipv6" do
107
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
108
+ record = i2p.get_all('2c0f:ffa0::4')
109
+ expect(record['country_short']).to eq '-'
110
+ end
111
+
112
+ it "work correctly with get_module_version" do
113
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
114
+ record = i2p.get_module_version()
115
+ expect(record).to eq '3.5.1'
116
+ end
117
+
118
+ it "work correctly with get_package_version" do
119
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
120
+ record = i2p.get_package_version()
121
+ expect(record).to eq '12'
122
+ end
123
+
124
+ it "work correctly with get_database_version" do
125
+ i2p = Ip2proxy.new.open(File.dirname(__FILE__) + "/assets/PX12.SAMPLE.BIN")
126
+ record = i2p.get_database_version()
127
+ expect(record).to eq '2025.2.5'
128
+ end
129
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ip2proxy_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.0
4
+ version: 3.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - ip2location
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 2.4.15
18
+ version: '3.0'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 2.4.15
25
+ version: '3.0'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: rspec
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - "~>"
31
31
  - !ruby/object:Gem::Version
32
- version: 2.8.0
32
+ version: '3.13'
33
33
  type: :development
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: 2.8.0
39
+ version: '3.13'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: rdoc
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -57,14 +57,14 @@ dependencies:
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 1.2.0
60
+ version: '2.4'
61
61
  type: :development
62
62
  prerelease: false
63
63
  version_requirements: !ruby/object:Gem::Requirement
64
64
  requirements:
65
65
  - - ">="
66
66
  - !ruby/object:Gem::Version
67
- version: 1.2.0
67
+ version: '2.4'
68
68
  description: The official IP2Proxy Ruby library to detect VPN servers, open proxies,
69
69
  web proxies, Tor exit nodes, search engine robots, data center ranges and residential
70
70
  proxies using IP2Proxy BIN database. Other information available includes proxy
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - ">="
113
113
  - !ruby/object:Gem::Version
114
- version: '0'
114
+ version: '3.0'
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - ">="