iptoasn 1.2.0 → 1.3.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/iptoasn/iptoasn.rb +4 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35a255d0f44e5d8c30e8b16f43a6827d755efd5d82309cda9097952791acf07b
4
- data.tar.gz: b9e5b9bf9d8a908a34fee0f1f8ba67831e170c60ebe85e46a2eb60eed65851a3
3
+ metadata.gz: a30920b9c52f4805314a9d3572f8a3a8b5152b9d8f9b610172e9e8a78b40b31b
4
+ data.tar.gz: 448626dfaa1ff8c0ca1d20f23a4389ec6596c4e7a0b1e692b427a4f0477acf66
5
5
  SHA512:
6
- metadata.gz: dd0f1ec6eb277b812dcac18db162314481ebd5d9ca49d43ce8ea470152649035478e632267bc3baa96b16df1196930445234d92f178039bca4fd2162a19b23d1
7
- data.tar.gz: 1e6e339f59892c5c70b33882d40bbe443b452410a185f4bf51e6a9713fad25b0ad2978a07fa26845657ac1d06aaf554309c0046a746f687046c776fcd082508d
6
+ metadata.gz: 7708e778a762e03e6e0fa774a029a69c242389e7a945811d97aafcfa0026bb7e66772341a96abdc7897daff622d9bd638126446e956c428621bccc15b8310f48
7
+ data.tar.gz: 9d10f6ed471ae834ef7f529784c9a36f641528e8fa1a2da8a40684208c477267ff29a7b5d075dd8491c1b95d55774fb97365e260889a6c1f282c6d9953e60575
@@ -27,6 +27,7 @@ module IpToAsn
27
27
  @db_ip2asn.seek(0, IO::SEEK_END)
28
28
  @db_total_entries = @db_ip2asn.size / @entry_size
29
29
  @db_ip2asn.seek(0)
30
+ @mutex = Mutex.new
30
31
  end
31
32
 
32
33
  def ip_to_int(ip)
@@ -50,7 +51,9 @@ module IpToAsn
50
51
 
51
52
  return { as_number: 0, country_code: 'XX', as_name: reserved_range_name } unless reserved_range_name.nil?
52
53
 
53
- search_db(ip)
54
+ @mutex.synchronize do
55
+ search_db(ip)
56
+ end
54
57
  end
55
58
 
56
59
  def search_db(ip) # rubocop:disable Metrics/AbcSize
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: iptoasn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - OMAR
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-08 00:00:00.000000000 Z
11
+ date: 2025-02-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This gem wraps the IP to ASN dataset. It uses lazy loading so it doesn't
14
14
  load the entire ~25M dataset all at once.