geoip_whois_asn_country 0.2.1 → 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: 45dc8c6b2e92085a314227f3092fcb0e6627555d6bc6296cfdd59d1255ac7ef5
4
- data.tar.gz: e4b1a71400b740a4aeb218a307a711e7fd2c215c0cd61243f996981779c9af2b
3
+ metadata.gz: 146bb167bdadc81b1d000b23ed9204d8ee34a2d00d99ea8c708629fb8e818219
4
+ data.tar.gz: c7abe914a1771c854bf71fa4797f0183b3011407468e5f9cc40bfcec94e1d30f
5
5
  SHA512:
6
- metadata.gz: 3c67a6e4f468f06362cb0ad9ff21f686b516f5976062b1bc78a532d4dd1d04f982ffbf6a062431b3dd2204fe99756e3611d9f4a801162db7e0dbf17446185cc0
7
- data.tar.gz: e7735e22c985b68d301bafa92ff3f7041cfa820db563c7a0eb4d8feadc908ba496755f0ec43f1e941964d49d2316b8d8125df73dd420425101501c96cac612b0
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.1"
4
+ VERSION = "0.2.2"
5
5
  end
@@ -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.1
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.