geoip_whois_asn_country 0.2.0 → 0.2.2

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: 9cecafa6e6059a81d3f208c39aca786852eabedaa77e21fdef3f9b4e1904af2c
4
- data.tar.gz: 3b2920f165960fb295c102fea0d4128d3d62151e3a8462c44a5c672017769498
3
+ metadata.gz: 146bb167bdadc81b1d000b23ed9204d8ee34a2d00d99ea8c708629fb8e818219
4
+ data.tar.gz: c7abe914a1771c854bf71fa4797f0183b3011407468e5f9cc40bfcec94e1d30f
5
5
  SHA512:
6
- metadata.gz: 9089baf7322337e7671abdb35558f01a02b0333a385917c14db6c4249191aa1ec24d61e2d4e23ce34b743e9c53a565e6896a891f687e3b3b26ed7d3597c75651
7
- data.tar.gz: '01857dec38fb490b811aaf5670ac29c0d3d686a80cc9cb02927def150bc2607d576f771f1afbad63946fde13a5500f34f13449d3b720dfc4047936157ff1be91'
6
+ metadata.gz: 5050d51c3743ad0de5c5ac6e08bd316548337736d540a44991e1a56a1d5f9d8b35f40791b11b2d12c8c9b735b0fb299f7bd11dccbf7cf1e02cde22ec2411d6bf
7
+ data.tar.gz: 912da4a6e208c287719dfafb5510d220f171eeda8bb7620ff84dec6f710df084e8d556b27a28b4cfa5b81ede656858a21990845e5ab4492eedba0c0bd2d46ad1
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GeoipWhoisAsnCountry
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
@@ -18,7 +18,7 @@ module GeoipWhoisAsnCountry
18
18
  include Singleton
19
19
 
20
20
  class << self
21
- attr_accessor :ipv4_num_csv_path, :ipv6_num_csv_path, :cache_path
21
+ attr_accessor :ipv4_num_csv_path, :ipv6_num_csv_path, :cache_path, :cache_time
22
22
  end
23
23
  self.ipv4_num_csv_path = "./node_modules/@ip-location-db/geo-whois-asn-country/geo-whois-asn-country-ipv4-num.csv"
24
24
  self.ipv6_num_csv_path = "./node_modules/@ip-location-db/geo-whois-asn-country/geo-whois-asn-country-ipv6-num.csv"
@@ -90,9 +90,11 @@ module GeoipWhoisAsnCountry
90
90
  ip = IPAddr.new(ip) if ip.is_a?(String)
91
91
  ip_i = ip.to_i
92
92
  if ip.ipv4?
93
- @ipv4_map[@ipv4_sorted_keys.bsearch { |x| x >= ip_i }]
93
+ key = @ipv4_sorted_keys.bsearch_index { |x| x > ip_i }
94
+ @ipv4_map[@ipv4_sorted_keys[key - 1]]
94
95
  else
95
- @ipv6_map[@ipv6_sorted_keys.bsearch { |x| x >= ip_i }]
96
+ key = @ipv6_sorted_keys.bsearch_index { |x| x > ip_i }
97
+ @ipv6_map[@ipv6_sorted_keys[key - 1]]
96
98
  end
97
99
  end
98
100
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: geoip_whois_asn_country
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stefan Wienert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-08-21 00:00:00.000000000 Z
11
+ date: 2023-08-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Efficient lookup of ipv4/ipv6 to country using the node-modules's geo-whois-asn-country
14
14
  CSVs.