maxmind-geoip2 0.2.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (98) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGELOG.md +33 -0
  3. data/Gemfile +1 -7
  4. data/README.dev.md +1 -1
  5. data/README.md +36 -14
  6. data/lib/maxmind/geoip2/client.rb +289 -265
  7. data/lib/maxmind/geoip2/errors.rb +0 -7
  8. data/lib/maxmind/geoip2/model/abstract.rb +19 -15
  9. data/lib/maxmind/geoip2/model/anonymous_ip.rb +62 -50
  10. data/lib/maxmind/geoip2/model/asn.rb +33 -29
  11. data/lib/maxmind/geoip2/model/city.rb +59 -55
  12. data/lib/maxmind/geoip2/model/connection_type.rb +27 -23
  13. data/lib/maxmind/geoip2/model/country.rb +57 -53
  14. data/lib/maxmind/geoip2/model/domain.rb +27 -23
  15. data/lib/maxmind/geoip2/model/enterprise.rb +13 -9
  16. data/lib/maxmind/geoip2/model/insights.rb +12 -8
  17. data/lib/maxmind/geoip2/model/isp.rb +45 -41
  18. data/lib/maxmind/geoip2/reader.rb +260 -233
  19. data/lib/maxmind/geoip2/record/abstract.rb +17 -13
  20. data/lib/maxmind/geoip2/record/city.rb +33 -29
  21. data/lib/maxmind/geoip2/record/continent.rb +32 -28
  22. data/lib/maxmind/geoip2/record/country.rb +47 -43
  23. data/lib/maxmind/geoip2/record/location.rb +64 -60
  24. data/lib/maxmind/geoip2/record/maxmind.rb +14 -10
  25. data/lib/maxmind/geoip2/record/place.rb +22 -18
  26. data/lib/maxmind/geoip2/record/postal.rb +26 -22
  27. data/lib/maxmind/geoip2/record/represented_country.rb +20 -16
  28. data/lib/maxmind/geoip2/record/subdivision.rb +42 -38
  29. data/lib/maxmind/geoip2/record/traits.rb +204 -191
  30. data/maxmind-geoip2.gemspec +10 -3
  31. data/test/data/LICENSE +4 -0
  32. data/test/data/MaxMind-DB-spec.md +570 -0
  33. data/test/data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  34. data/test/data/README.md +4 -0
  35. data/test/data/bad-data/README.md +7 -0
  36. data/test/data/bad-data/libmaxminddb/libmaxminddb-offset-integer-overflow.mmdb +0 -0
  37. data/test/data/bad-data/maxminddb-golang/cyclic-data-structure.mmdb +0 -0
  38. data/test/data/bad-data/maxminddb-golang/invalid-bytes-length.mmdb +1 -0
  39. data/test/data/bad-data/maxminddb-golang/invalid-data-record-offset.mmdb +0 -0
  40. data/test/data/bad-data/maxminddb-golang/invalid-map-key-length.mmdb +0 -0
  41. data/test/data/bad-data/maxminddb-golang/invalid-string-length.mmdb +1 -0
  42. data/test/data/bad-data/maxminddb-golang/metadata-is-an-uint128.mmdb +1 -0
  43. data/test/data/bad-data/maxminddb-golang/unexpected-bytes.mmdb +0 -0
  44. data/test/data/bad-data/maxminddb-python/bad-unicode-in-map-key.mmdb +0 -0
  45. data/test/data/perltidyrc +12 -0
  46. data/test/data/source-data/GeoIP2-Anonymous-IP-Test.json +49 -0
  47. data/test/data/source-data/GeoIP2-City-Test.json +12852 -0
  48. data/test/data/source-data/GeoIP2-Connection-Type-Test.json +102 -0
  49. data/test/data/source-data/GeoIP2-Country-Test.json +15916 -0
  50. data/test/data/source-data/GeoIP2-DensityIncome-Test.json +14 -0
  51. data/test/data/source-data/GeoIP2-Domain-Test.json +452 -0
  52. data/test/data/source-data/GeoIP2-Enterprise-Test.json +687 -0
  53. data/test/data/source-data/GeoIP2-ISP-Test.json +12595 -0
  54. data/test/data/source-data/GeoIP2-Precision-Enterprise-Test.json +2148 -0
  55. data/test/data/source-data/GeoIP2-Static-IP-Score-Test.json +2132 -0
  56. data/test/data/source-data/GeoIP2-User-Count-Test.json +2837 -0
  57. data/test/data/source-data/GeoLite2-ASN-Test.json +37 -0
  58. data/test/data/source-data/README +15 -0
  59. data/test/data/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
  60. data/test/data/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
  61. data/test/data/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
  62. data/test/data/test-data/GeoIP2-City-Test.mmdb +0 -0
  63. data/test/data/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
  64. data/test/data/test-data/GeoIP2-Country-Test.mmdb +0 -0
  65. data/test/data/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
  66. data/test/data/test-data/GeoIP2-Domain-Test.mmdb +0 -0
  67. data/test/data/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
  68. data/test/data/test-data/GeoIP2-ISP-Test.mmdb +0 -0
  69. data/test/data/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
  70. data/test/data/test-data/GeoIP2-Static-IP-Score-Test.mmdb +0 -0
  71. data/test/data/test-data/GeoIP2-User-Count-Test.mmdb +0 -0
  72. data/test/data/test-data/GeoLite2-ASN-Test.mmdb +0 -0
  73. data/test/data/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
  74. data/test/data/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
  75. data/test/data/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
  76. data/test/data/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
  77. data/test/data/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
  78. data/test/data/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
  79. data/test/data/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
  80. data/test/data/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
  81. data/test/data/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
  82. data/test/data/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
  83. data/test/data/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
  84. data/test/data/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  85. data/test/data/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
  86. data/test/data/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
  87. data/test/data/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
  88. data/test/data/test-data/MaxMind-DB-test-nested.mmdb +0 -0
  89. data/test/data/test-data/MaxMind-DB-test-pointer-decoder.mmdb +0 -0
  90. data/test/data/test-data/README.md +26 -0
  91. data/test/data/test-data/maps-with-pointers.raw +0 -0
  92. data/test/data/test-data/write-test-data.pl +691 -0
  93. data/test/data/tidyall.ini +5 -0
  94. data/test/test_client.rb +4 -2
  95. data/test/test_model_country.rb +16 -0
  96. data/test/test_reader.rb +59 -0
  97. metadata +156 -10
  98. data/Gemfile.lock +0 -70
@@ -0,0 +1,14 @@
1
+ [
2
+ {
3
+ "::5.83.124.0/118" : {
4
+ "average_income" : 32323,
5
+ "population_density" : 1232
6
+ }
7
+ },
8
+ {
9
+ "::216.160.83.0/120" : {
10
+ "average_income" : 24626,
11
+ "population_density" : 1341
12
+ }
13
+ }
14
+ ]
@@ -0,0 +1,452 @@
1
+ [
2
+ {
3
+ "::1.2.0.0/112" : {
4
+ "domain" : "maxmind.com"
5
+ }
6
+ },
7
+ {
8
+ "::71.160.223.0/120" : {
9
+ "domain" : "verizon.net"
10
+ }
11
+ },
12
+ {
13
+ "::186.30.236.0/120" : {
14
+ "domain" : "replaced.com"
15
+ }
16
+ },
17
+ {
18
+ "2a02:2770:3::/64" : {
19
+ "domain" : "sgotti.org"
20
+ }
21
+ },
22
+ {
23
+ "2a02:8420:48f4:b000::/64" : {
24
+ "domain" : "sfr.net"
25
+ }
26
+ },
27
+ {
28
+ "::142.217.194.0/119" : {
29
+ "domain" : "telebecinternet.net"
30
+ }
31
+ },
32
+ {
33
+ "::142.217.196.0/118" : {
34
+ "domain" : "telebecinternet.net"
35
+ }
36
+ },
37
+ {
38
+ "::142.217.200.0/117" : {
39
+ "domain" : "telebecinternet.net"
40
+ }
41
+ },
42
+ {
43
+ "::142.217.208.0/118" : {
44
+ "domain" : "telebecinternet.net"
45
+ }
46
+ },
47
+ {
48
+ "::142.217.212.0/119" : {
49
+ "domain" : "telebecinternet.net"
50
+ }
51
+ },
52
+ {
53
+ "::142.217.214.0/120" : {
54
+ "domain" : "telebecinternet.net"
55
+ }
56
+ },
57
+ {
58
+ "::208.110.201.0/120" : {
59
+ "domain" : "comcastbusiness.net"
60
+ }
61
+ },
62
+ {
63
+ "::208.110.202.0/119" : {
64
+ "domain" : "comcastbusiness.net"
65
+ }
66
+ },
67
+ {
68
+ "::208.110.204.0/118" : {
69
+ "domain" : "comcastbusiness.net"
70
+ }
71
+ },
72
+ {
73
+ "::208.110.208.0/116" : {
74
+ "domain" : "comcastbusiness.net"
75
+ }
76
+ },
77
+ {
78
+ "::222.230.136.0/118" : {
79
+ "domain" : "gol.ne.jp"
80
+ }
81
+ },
82
+ {
83
+ "::65.115.240.0/116" : {
84
+ "domain" : "qwest.net"
85
+ }
86
+ },
87
+ {
88
+ "::65.116.0.0/118" : {
89
+ "domain" : "qwest.net"
90
+ }
91
+ },
92
+ {
93
+ "::65.116.4.0/120" : {
94
+ "domain" : "qwest.net"
95
+ }
96
+ },
97
+ {
98
+ "::65.23.96.0/115" : {
99
+ "domain" : "nuvox.net"
100
+ }
101
+ },
102
+ {
103
+ "::66.92.78.0/119" : {
104
+ "domain" : "speakeasy.net"
105
+ }
106
+ },
107
+ {
108
+ "::66.92.80.0/116" : {
109
+ "domain" : "speakeasy.net"
110
+ }
111
+ },
112
+ {
113
+ "::66.92.96.0/115" : {
114
+ "domain" : "speakeasy.net"
115
+ }
116
+ },
117
+ {
118
+ "::66.92.128.0/113" : {
119
+ "domain" : "speakeasy.net"
120
+ }
121
+ },
122
+ {
123
+ "::66.93.0.0/113" : {
124
+ "domain" : "speakeasy.net"
125
+ }
126
+ },
127
+ {
128
+ "::66.93.128.0/114" : {
129
+ "domain" : "speakeasy.net"
130
+ }
131
+ },
132
+ {
133
+ "::66.93.192.0/115" : {
134
+ "domain" : "speakeasy.net"
135
+ }
136
+ },
137
+ {
138
+ "::66.93.224.0/116" : {
139
+ "domain" : "speakeasy.net"
140
+ }
141
+ },
142
+ {
143
+ "::66.93.240.0/117" : {
144
+ "domain" : "speakeasy.net"
145
+ }
146
+ },
147
+ {
148
+ "::66.93.248.0/119" : {
149
+ "domain" : "speakeasy.net"
150
+ }
151
+ },
152
+ {
153
+ "::67.43.156.0/120" : {
154
+ "domain" : "shoesfin.NET"
155
+ }
156
+ },
157
+ {
158
+ "::69.218.198.0/119" : {
159
+ "domain" : "ameritech.net"
160
+ }
161
+ },
162
+ {
163
+ "::69.218.200.0/117" : {
164
+ "domain" : "ameritech.net"
165
+ }
166
+ },
167
+ {
168
+ "::69.218.208.0/116" : {
169
+ "domain" : "ameritech.net"
170
+ }
171
+ },
172
+ {
173
+ "::69.218.224.0/115" : {
174
+ "domain" : "ameritech.net"
175
+ }
176
+ },
177
+ {
178
+ "::69.219.0.0/114" : {
179
+ "domain" : "ameritech.net"
180
+ }
181
+ },
182
+ {
183
+ "::69.219.64.0/116" : {
184
+ "domain" : "ameritech.net"
185
+ }
186
+ },
187
+ {
188
+ "::69.219.80.0/118" : {
189
+ "domain" : "ameritech.net"
190
+ }
191
+ },
192
+ {
193
+ "::69.219.84.0/120" : {
194
+ "domain" : "ameritech.net"
195
+ }
196
+ },
197
+ {
198
+ "::70.46.0.0/113" : {
199
+ "domain" : "nuvox.net"
200
+ }
201
+ },
202
+ {
203
+ "::70.46.128.0/118" : {
204
+ "domain" : "nuvox.net"
205
+ }
206
+ },
207
+ {
208
+ "::70.46.132.0/120" : {
209
+ "domain" : "nuvox.net"
210
+ }
211
+ },
212
+ {
213
+ "::71.136.2.0/119" : {
214
+ "domain" : "pacbell.net"
215
+ }
216
+ },
217
+ {
218
+ "::71.136.4.0/118" : {
219
+ "domain" : "pacbell.net"
220
+ }
221
+ },
222
+ {
223
+ "::71.136.8.0/117" : {
224
+ "domain" : "pacbell.net"
225
+ }
226
+ },
227
+ {
228
+ "::71.136.16.0/116" : {
229
+ "domain" : "pacbell.net"
230
+ }
231
+ },
232
+ {
233
+ "::71.136.32.0/115" : {
234
+ "domain" : "pacbell.net"
235
+ }
236
+ },
237
+ {
238
+ "::71.136.64.0/114" : {
239
+ "domain" : "pacbell.net"
240
+ }
241
+ },
242
+ {
243
+ "::71.136.128.0/113" : {
244
+ "domain" : "pacbell.net"
245
+ }
246
+ },
247
+ {
248
+ "::71.137.0.0/112" : {
249
+ "domain" : "pacbell.net"
250
+ }
251
+ },
252
+ {
253
+ "::71.138.0.0/113" : {
254
+ "domain" : "pacbell.net"
255
+ }
256
+ },
257
+ {
258
+ "::71.138.128.0/114" : {
259
+ "domain" : "pacbell.net"
260
+ }
261
+ },
262
+ {
263
+ "::71.138.192.0/116" : {
264
+ "domain" : "pacbell.net"
265
+ }
266
+ },
267
+ {
268
+ "::71.138.208.0/119" : {
269
+ "domain" : "pacbell.net"
270
+ }
271
+ },
272
+ {
273
+ "::74.0.88.0/117" : {
274
+ "domain" : "covad.net"
275
+ }
276
+ },
277
+ {
278
+ "::74.0.96.0/115" : {
279
+ "domain" : "covad.net"
280
+ }
281
+ },
282
+ {
283
+ "::74.0.128.0/113" : {
284
+ "domain" : "covad.net"
285
+ }
286
+ },
287
+ {
288
+ "::74.1.0.0/112" : {
289
+ "domain" : "covad.net"
290
+ }
291
+ },
292
+ {
293
+ "::74.2.0.0/113" : {
294
+ "domain" : "covad.net"
295
+ }
296
+ },
297
+ {
298
+ "::74.2.128.0/115" : {
299
+ "domain" : "covad.net"
300
+ }
301
+ },
302
+ {
303
+ "::74.2.160.0/117" : {
304
+ "domain" : "covad.net"
305
+ }
306
+ },
307
+ {
308
+ "::74.2.168.0/118" : {
309
+ "domain" : "covad.net"
310
+ }
311
+ },
312
+ {
313
+ "::74.2.172.0/119" : {
314
+ "domain" : "covad.net"
315
+ }
316
+ },
317
+ {
318
+ "::74.2.174.0/120" : {
319
+ "domain" : "covad.net"
320
+ }
321
+ },
322
+ {
323
+ "::75.77.84.0/118" : {
324
+ "domain" : "nuvox.net"
325
+ }
326
+ },
327
+ {
328
+ "::75.77.88.0/117" : {
329
+ "domain" : "nuvox.net"
330
+ }
331
+ },
332
+ {
333
+ "::75.77.96.0/115" : {
334
+ "domain" : "nuvox.net"
335
+ }
336
+ },
337
+ {
338
+ "::75.77.128.0/113" : {
339
+ "domain" : "nuvox.net"
340
+ }
341
+ },
342
+ {
343
+ "::78.26.67.0/120" : {
344
+ "domain" : "popwifi.it"
345
+ }
346
+ },
347
+ {
348
+ "::78.26.68.0/118" : {
349
+ "domain" : "popwifi.it"
350
+ }
351
+ },
352
+ {
353
+ "::78.26.72.0/117" : {
354
+ "domain" : "popwifi.it"
355
+ }
356
+ },
357
+ {
358
+ "::78.26.80.0/116" : {
359
+ "domain" : "popwifi.it"
360
+ }
361
+ },
362
+ {
363
+ "::78.26.96.0/117" : {
364
+ "domain" : "popwifi.it"
365
+ }
366
+ },
367
+ {
368
+ "::78.26.104.0/118" : {
369
+ "domain" : "popwifi.it"
370
+ }
371
+ },
372
+ {
373
+ "::78.26.108.0/119" : {
374
+ "domain" : "popwifi.it"
375
+ }
376
+ },
377
+ {
378
+ "::78.26.110.0/120" : {
379
+ "domain" : "popwifi.it"
380
+ }
381
+ },
382
+ {
383
+ "::81.2.64.0/115" : {
384
+ "domain" : "in-addr.arpa"
385
+ }
386
+ },
387
+ {
388
+ "::83.206.0.0/112" : {
389
+ "domain" : "oleane.fr"
390
+ }
391
+ },
392
+ {
393
+ "::89.160.0.0/116" : {
394
+ "domain" : "bredband2.com"
395
+ }
396
+ },
397
+ {
398
+ "::89.160.16.0/117" : {
399
+ "domain" : "bredband2.com"
400
+ }
401
+ },
402
+ {
403
+ "::89.160.24.0/118" : {
404
+ "domain" : "bredband2.com"
405
+ }
406
+ },
407
+ {
408
+ "::89.160.28.0/119" : {
409
+ "domain" : "bredband2.com"
410
+ }
411
+ },
412
+ {
413
+ "::89.160.30.0/120" : {
414
+ "domain" : "bredband2.com"
415
+ }
416
+ },
417
+ {
418
+ "::89.92.0.0/111" : {
419
+ "domain" : "bbox.fr"
420
+ }
421
+ },
422
+ {
423
+ "::89.94.0.0/112" : {
424
+ "domain" : "bbox.fr"
425
+ }
426
+ },
427
+ {
428
+ "::89.95.0.0/113" : {
429
+ "domain" : "bbox.fr"
430
+ }
431
+ },
432
+ {
433
+ "::89.95.128.0/114" : {
434
+ "domain" : "bbox.fr"
435
+ }
436
+ },
437
+ {
438
+ "::89.95.192.0/115" : {
439
+ "domain" : "bbox.fr"
440
+ }
441
+ },
442
+ {
443
+ "::89.95.224.0/116" : {
444
+ "domain" : "bbox.fr"
445
+ }
446
+ },
447
+ {
448
+ "::89.95.240.0/119" : {
449
+ "domain" : "bbox.fr"
450
+ }
451
+ }
452
+ ]