maxmind-db 1.1.1 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/README.dev.md +13 -5
  4. data/README.md +2 -3
  5. data/bin/mmdb-benchmark.rb +3 -3
  6. data/lib/maxmind/db/decoder.rb +3 -0
  7. data/lib/maxmind/db/file_reader.rb +29 -11
  8. data/lib/maxmind/db.rb +9 -10
  9. data/maxmind-db.gemspec +4 -3
  10. data/test/data/MaxMind-DB-spec.md +15 -11
  11. data/test/data/bad-data/maxminddb-python/bad-unicode-in-map-key.mmdb +0 -0
  12. data/test/data/source-data/GeoIP2-Anonymous-IP-Test.json +1 -0
  13. data/test/data/source-data/GeoIP2-City-Test.json +81 -48
  14. data/test/data/source-data/GeoIP2-Connection-Type-Test.json +20 -0
  15. data/test/data/source-data/GeoIP2-Country-Test.json +46 -58
  16. data/test/data/source-data/GeoIP2-Enterprise-Test.json +78 -6
  17. data/test/data/source-data/GeoIP2-ISP-Test.json +13 -1
  18. data/test/data/source-data/GeoIP2-Precision-Enterprise-Test.json +200 -13
  19. data/test/data/source-data/GeoLite2-ASN-Test.json +4091 -8
  20. data/test/data/source-data/GeoLite2-City-Test.json +12804 -0
  21. data/test/data/source-data/GeoLite2-Country-Test.json +11280 -0
  22. data/test/data/test-data/GeoIP2-Anonymous-IP-Test.mmdb +0 -0
  23. data/test/data/test-data/GeoIP2-City-Test-Broken-Double-Format.mmdb +0 -0
  24. data/test/data/test-data/GeoIP2-City-Test-Invalid-Node-Count.mmdb +0 -0
  25. data/test/data/test-data/GeoIP2-City-Test.mmdb +0 -0
  26. data/test/data/test-data/GeoIP2-Connection-Type-Test.mmdb +0 -0
  27. data/test/data/test-data/GeoIP2-Country-Test.mmdb +0 -0
  28. data/test/data/test-data/GeoIP2-DensityIncome-Test.mmdb +0 -0
  29. data/test/data/test-data/GeoIP2-Domain-Test.mmdb +0 -0
  30. data/test/data/test-data/GeoIP2-Enterprise-Test.mmdb +0 -0
  31. data/test/data/test-data/GeoIP2-ISP-Test.mmdb +0 -0
  32. data/test/data/test-data/GeoIP2-Precision-Enterprise-Test.mmdb +0 -0
  33. data/test/data/test-data/GeoIP2-Static-IP-Score-Test.mmdb +0 -0
  34. data/test/data/test-data/GeoIP2-User-Count-Test.mmdb +0 -0
  35. data/test/data/test-data/GeoLite2-ASN-Test.mmdb +0 -0
  36. data/test/data/test-data/GeoLite2-City-Test.mmdb +0 -0
  37. data/test/data/test-data/GeoLite2-Country-Test.mmdb +0 -0
  38. data/test/data/test-data/MaxMind-DB-no-ipv4-search-tree.mmdb +0 -0
  39. data/test/data/test-data/MaxMind-DB-string-value-entries.mmdb +0 -0
  40. data/test/data/test-data/MaxMind-DB-test-broken-pointers-24.mmdb +0 -0
  41. data/test/data/test-data/MaxMind-DB-test-broken-search-tree-24.mmdb +0 -0
  42. data/test/data/test-data/MaxMind-DB-test-decoder.mmdb +0 -0
  43. data/test/data/test-data/MaxMind-DB-test-ipv4-24.mmdb +0 -0
  44. data/test/data/test-data/MaxMind-DB-test-ipv4-28.mmdb +0 -0
  45. data/test/data/test-data/MaxMind-DB-test-ipv4-32.mmdb +0 -0
  46. data/test/data/test-data/MaxMind-DB-test-ipv6-24.mmdb +0 -0
  47. data/test/data/test-data/MaxMind-DB-test-ipv6-28.mmdb +0 -0
  48. data/test/data/test-data/MaxMind-DB-test-ipv6-32.mmdb +0 -0
  49. data/test/data/test-data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
  50. data/test/data/test-data/MaxMind-DB-test-mixed-24.mmdb +0 -0
  51. data/test/data/test-data/MaxMind-DB-test-mixed-28.mmdb +0 -0
  52. data/test/data/test-data/MaxMind-DB-test-mixed-32.mmdb +0 -0
  53. data/test/data/test-data/MaxMind-DB-test-nested.mmdb +0 -0
  54. data/test/data/test-data/MaxMind-DB-test-pointer-decoder.mmdb +0 -0
  55. data/test/data/test-data/README.md +3 -3
  56. data/test/data/test-data/write-test-data.pl +77 -22
  57. data/test/test_decoder.rb +6 -6
  58. data/test/test_reader.rb +22 -13
  59. metadata +12 -7
  60. data/test/data/MaxMind-DB-test-metadata-pointers.mmdb +0 -0
@@ -56,6 +56,7 @@
56
56
  "connection_type" : "Cellular",
57
57
  "isp" : "Iran Cell Service and Communication Company",
58
58
  "organization" : "Iran Cell Service and Communication Company",
59
+ "static_ip_score" : 0.25,
59
60
  "user_type" : "cellular"
60
61
  }
61
62
  }
@@ -139,6 +140,7 @@
139
140
  "connection_type" : "Cable/DSL",
140
141
  "isp" : "CrimeaCom South LLC",
141
142
  "organization" : "CrimeaCom South LLC",
143
+ "static_ip_score" : 0.26,
142
144
  "user_type" : "residential"
143
145
  }
144
146
  }
@@ -169,7 +171,6 @@
169
171
  "country" : {
170
172
  "confidence" : 95,
171
173
  "geoname_id" : 2635167,
172
- "is_in_european_union" : true,
173
174
  "iso_code" : "GB",
174
175
  "names" : {
175
176
  "de" : "Vereinigtes Königreich",
@@ -228,7 +229,10 @@
228
229
  "zh-CN" : "西伯克郡"
229
230
  }
230
231
  }
231
- ]
232
+ ],
233
+ "traits" : {
234
+ "static_ip_score" : 0.27
235
+ }
232
236
  }
233
237
  },
234
238
  {
@@ -250,7 +254,8 @@
250
254
  },
251
255
  "traits" : {
252
256
  "is_anonymous_proxy" : true,
253
- "isp" : "WifiNetCom"
257
+ "isp" : "WifiNetCom",
258
+ "static_ip_score" : 0.28
254
259
  }
255
260
  }
256
261
  },
@@ -259,7 +264,8 @@
259
264
  "traits" : {
260
265
  "autonomous_system_number" : 7018,
261
266
  "isp" : "AT&T Services",
262
- "organization" : "AT&T Worldnet Services"
267
+ "organization" : "AT&T Worldnet Services",
268
+ "static_ip_score" : 0.31
263
269
  }
264
270
  }
265
271
  },
@@ -327,7 +333,10 @@
327
333
  "en" : "Northern Region"
328
334
  }
329
335
  }
330
- ]
336
+ ],
337
+ "traits" : {
338
+ "static_ip_score" : 0.33
339
+ }
331
340
  }
332
341
  },
333
342
  {
@@ -423,6 +432,7 @@
423
432
  "connection_type" : "Corporate",
424
433
  "isp" : "Towerstream I",
425
434
  "organization" : "Towerstream I",
435
+ "static_ip_score" : 0.34,
426
436
  "user_type" : "business"
427
437
  }
428
438
  }
@@ -517,6 +527,7 @@
517
527
  "domain" : "qwest.net",
518
528
  "isp" : "CenturyLink",
519
529
  "organization" : "CenturyLink",
530
+ "static_ip_score" : 0.34,
520
531
  "user_type" : "residential"
521
532
  }
522
533
  }
@@ -614,6 +625,7 @@
614
625
  "domain" : "speakeasy.net",
615
626
  "isp" : "Speakeasy",
616
627
  "organization" : "Vikco Insurance",
628
+ "static_ip_score" : 0.34,
617
629
  "user_type" : "government"
618
630
  }
619
631
  }
@@ -676,6 +688,7 @@
676
688
  "is_anonymous_proxy" : true,
677
689
  "isp" : "Loud Packet",
678
690
  "organization" : "zudoarichikito_",
691
+ "static_ip_score" : 0.34,
679
692
  "user_type" : "search_engine_spider"
680
693
  }
681
694
  }
@@ -770,6 +783,7 @@
770
783
  "is_satellite_provider" : true,
771
784
  "isp" : "Fairpoint Communications",
772
785
  "organization" : "Fairpoint Communications",
786
+ "static_ip_score" : 0.34,
773
787
  "user_type" : "residential"
774
788
  }
775
789
  }
@@ -864,6 +878,7 @@
864
878
  "is_satellite_provider" : true,
865
879
  "isp" : "Fairpoint Communications",
866
880
  "organization" : "Fairpoint Communications",
881
+ "static_ip_score" : 0.35,
867
882
  "user_type" : "residential"
868
883
  }
869
884
  }
@@ -900,7 +915,6 @@
900
915
  "country" : {
901
916
  "confidence" : 95,
902
917
  "geoname_id" : 2635167,
903
- "is_in_european_union" : true,
904
918
  "iso_code" : "GB",
905
919
  "names" : {
906
920
  "de" : "Vereinigtes Königreich",
@@ -947,7 +961,8 @@
947
961
  }
948
962
  ],
949
963
  "traits" : {
950
- "domain" : "in-addr.arpa"
964
+ "domain" : "in-addr.arpa",
965
+ "static_ip_score" : 0.34
951
966
  }
952
967
  }
953
968
  },
@@ -983,7 +998,6 @@
983
998
  "country" : {
984
999
  "confidence" : 99,
985
1000
  "geoname_id" : 2635167,
986
- "is_in_european_union" : true,
987
1001
  "iso_code" : "GB",
988
1002
  "names" : {
989
1003
  "de" : "Vereinigtes Königreich",
@@ -1033,6 +1047,7 @@
1033
1047
  "domain" : "in-addr.arpa",
1034
1048
  "isp" : "Andrews & Arnold Ltd",
1035
1049
  "organization" : "STONEHOUSE office network",
1050
+ "static_ip_score" : 0.34,
1036
1051
  "user_type" : "government"
1037
1052
  }
1038
1053
  }
@@ -1119,6 +1134,7 @@
1119
1134
  "domain" : "bredband2.com",
1120
1135
  "isp" : "Bredband2 AB",
1121
1136
  "organization" : "Bevtec",
1137
+ "static_ip_score" : 0.34,
1122
1138
  "user_type" : "government"
1123
1139
  }
1124
1140
  }
@@ -1210,7 +1226,8 @@
1210
1226
  "autonomous_system_number" : 2313,
1211
1227
  "autonomous_system_organization" : "Precision AS Org",
1212
1228
  "isp" : "Precision ISP",
1213
- "organization" : "Precision Org"
1229
+ "organization" : "Precision Org",
1230
+ "static_ip_score" : 0.46
1214
1231
  }
1215
1232
  }
1216
1233
  },
@@ -1302,10 +1319,72 @@
1302
1319
  "connection_type" : "Cable/DSL",
1303
1320
  "isp" : "The Corporation for Financing and Promoting Techno",
1304
1321
  "organization" : "FPT Telecom Company",
1322
+ "static_ip_score" : 0.46,
1305
1323
  "user_type" : "business"
1306
1324
  }
1307
1325
  }
1308
1326
  },
1327
+ {
1328
+ "::149.101.100.0/124" : {
1329
+ "continent" : {
1330
+ "code" : "NA",
1331
+ "geoname_id" : 6255149,
1332
+ "names" : {
1333
+ "de" : "Nordamerika",
1334
+ "en" : "North America",
1335
+ "es" : "América del Norte",
1336
+ "fr" : "Amérique du Nord",
1337
+ "ja" : "北アメリカ",
1338
+ "pt-BR" : "América do Norte",
1339
+ "ru" : "Северная Америка",
1340
+ "zh-CN" : "北美洲"
1341
+ }
1342
+ },
1343
+ "country" : {
1344
+ "confidence" : 99,
1345
+ "geoname_id" : 6252001,
1346
+ "iso_code" : "US",
1347
+ "names" : {
1348
+ "de" : "USA",
1349
+ "en" : "United States",
1350
+ "es" : "Estados Unidos",
1351
+ "fr" : "États-Unis",
1352
+ "ja" : "アメリカ合衆国",
1353
+ "pt-BR" : "Estados Unidos",
1354
+ "ru" : "США",
1355
+ "zh-CN" : "美国"
1356
+ }
1357
+ },
1358
+ "location" : {
1359
+ "accuracy_radius" : 1000,
1360
+ "latitude" : 37.751,
1361
+ "longitude" : -97.822,
1362
+ "time_zone" : "America/Chicago"
1363
+ },
1364
+ "registered_country" : {
1365
+ "geoname_id" : 2635167,
1366
+ "iso_code" : "GB",
1367
+ "names" : {
1368
+ "de" : "Vereinigtes Königreich",
1369
+ "en" : "United Kingdom",
1370
+ "es" : "Reino Unido",
1371
+ "fr" : "Royaume-Uni",
1372
+ "ja" : "イギリス",
1373
+ "pt-BR" : "Reino Unido",
1374
+ "ru" : "Великобритания",
1375
+ "zh-CN" : "英国"
1376
+ }
1377
+ },
1378
+ "traits" : {
1379
+ "autonomous_system_number" : 6167,
1380
+ "autonomous_system_organization" : "CELLCO-PART",
1381
+ "isp" : "Verizon Wireless",
1382
+ "mobile_country_code" : "310",
1383
+ "mobile_network_code" : "004",
1384
+ "organization" : "Verizon Wireless"
1385
+ }
1386
+ }
1387
+ },
1309
1388
  {
1310
1389
  "::175.16.199.0/120" : {
1311
1390
  "city" : {
@@ -1381,6 +1460,7 @@
1381
1460
  }
1382
1461
  ],
1383
1462
  "traits" : {
1463
+ "static_ip_score" : 0.63,
1384
1464
  "user_type" : "dialup"
1385
1465
  }
1386
1466
  }
@@ -1388,7 +1468,8 @@
1388
1468
  {
1389
1469
  "::188.35.144.0/119" : {
1390
1470
  "traits" : {
1391
- "organization" : "CityLink Ltd"
1471
+ "organization" : "CityLink Ltd",
1472
+ "static_ip_score" : 0.64
1392
1473
  }
1393
1474
  }
1394
1475
  },
@@ -1461,6 +1542,9 @@
1461
1542
  "zh-CN" : "美国"
1462
1543
  },
1463
1544
  "type" : "military"
1545
+ },
1546
+ "traits" : {
1547
+ "static_ip_score" : 1.29
1464
1548
  }
1465
1549
  }
1466
1550
  },
@@ -1552,6 +1636,7 @@
1552
1636
  "domain" : "comcastbusiness.net",
1553
1637
  "isp" : "Comcast Business",
1554
1638
  "organization" : "Comcast Business",
1639
+ "static_ip_score" : 1.47,
1555
1640
  "user_type" : "business"
1556
1641
  }
1557
1642
  }
@@ -1608,7 +1693,6 @@
1608
1693
  },
1609
1694
  "registered_country" : {
1610
1695
  "geoname_id" : 2635167,
1611
- "is_in_european_union" : true,
1612
1696
  "iso_code" : "GB",
1613
1697
  "names" : {
1614
1698
  "de" : "Vereinigtes Königreich",
@@ -1641,6 +1725,7 @@
1641
1725
  "connection_type" : "Cable/DSL",
1642
1726
  "isp" : "Century Link",
1643
1727
  "organization" : "Lariat Software",
1728
+ "static_ip_score" : 1.47,
1644
1729
  "user_type" : "government"
1645
1730
  }
1646
1731
  }
@@ -1695,6 +1780,9 @@
1695
1780
  "ru" : "Япония",
1696
1781
  "zh-CN" : "日本"
1697
1782
  }
1783
+ },
1784
+ "traits" : {
1785
+ "static_ip_score" : 2.81
1698
1786
  }
1699
1787
  }
1700
1788
  },
@@ -1747,6 +1835,9 @@
1747
1835
  "ru" : "Китай",
1748
1836
  "zh-CN" : "中国"
1749
1837
  }
1838
+ },
1839
+ "traits" : {
1840
+ "static_ip_score" : 2.81
1750
1841
  }
1751
1842
  }
1752
1843
  },
@@ -1802,26 +1893,32 @@
1802
1893
  "ru" : "Чешская Республика",
1803
1894
  "zh-CN" : "捷克共和国"
1804
1895
  }
1896
+ },
1897
+ "traits" : {
1898
+ "static_ip_score" : 4.17
1805
1899
  }
1806
1900
  }
1807
1901
  },
1808
1902
  {
1809
1903
  "::212.47.235.81/128" : {
1810
1904
  "traits" : {
1811
- "is_anonymous_proxy" : true
1905
+ "is_anonymous_proxy" : true,
1906
+ "static_ip_score" : 1.47
1812
1907
  }
1813
1908
  }
1814
1909
  },
1815
1910
  {
1816
1911
  "::212.47.235.82/128" : {
1817
1912
  "traits" : {
1818
- "is_satellite_provider" : true
1913
+ "is_satellite_provider" : true,
1914
+ "static_ip_score" : 1.47
1819
1915
  }
1820
1916
  }
1821
1917
  },
1822
1918
  {
1823
1919
  "::1.9.127.107/128" : {
1824
1920
  "traits" : {
1921
+ "static_ip_score" : 0.22,
1825
1922
  "user_type" : "business"
1826
1923
  }
1827
1924
  }
@@ -1829,6 +1926,7 @@
1829
1926
  {
1830
1927
  "::102.35.19.0/128" : {
1831
1928
  "traits" : {
1929
+ "static_ip_score" : 0.4,
1832
1930
  "user_type" : "cellular"
1833
1931
  }
1834
1932
  }
@@ -1920,6 +2018,7 @@
1920
2018
  "domain" : "bredband2.com",
1921
2019
  "isp" : "Bredband2 AB",
1922
2020
  "organization" : "Bevtec",
2021
+ "static_ip_score" : 2.81,
1923
2022
  "user_type" : "government"
1924
2023
  }
1925
2024
  }
@@ -2011,8 +2110,96 @@
2011
2110
  "domain" : "bredband2.com",
2012
2111
  "isp" : "Bredband2 AB",
2013
2112
  "organization" : "Bevtec",
2113
+ "static_ip_score" : 2.82,
2014
2114
  "user_type" : "government"
2015
2115
  }
2016
2116
  }
2117
+ },
2118
+ {
2119
+ "::2.20.32.110/127" : {
2120
+ "city" : {
2121
+ "confidence" : 60,
2122
+ "geoname_id" : 315808,
2123
+ "names" : {
2124
+ "de" : "Elazığ",
2125
+ "en" : "Elâzığ",
2126
+ "fr" : "Elazığ",
2127
+ "ja" : "エラズー",
2128
+ "ru" : "Элязыг",
2129
+ "zh-CN" : "埃拉泽"
2130
+ }
2131
+ },
2132
+ "continent" : {
2133
+ "code" : "AS",
2134
+ "geoname_id" : 6255147,
2135
+ "names" : {
2136
+ "de" : "Asien",
2137
+ "en" : "Asia",
2138
+ "es" : "Asia",
2139
+ "fr" : "Asie",
2140
+ "ja" : "アジア",
2141
+ "pt-BR" : "Ásia",
2142
+ "ru" : "Азия",
2143
+ "zh-CN" : "亚洲"
2144
+ }
2145
+ },
2146
+ "country" : {
2147
+ "confidence" : 90,
2148
+ "geoname_id" : 298795,
2149
+ "iso_code" : "TR",
2150
+ "names" : {
2151
+ "de" : "Türkei",
2152
+ "en" : "Turkey",
2153
+ "es" : "Turquía",
2154
+ "fr" : "Turquie",
2155
+ "ja" : "トルコ共和国",
2156
+ "pt-BR" : "Turquia",
2157
+ "ru" : "Турция",
2158
+ "zh-CN" : "土耳其"
2159
+ }
2160
+ },
2161
+ "location" : {
2162
+ "accuracy_radius" : 50,
2163
+ "latitude" : 38.6229,
2164
+ "longitude" : 39.3217,
2165
+ "time_zone" : "Europe/Istanbul"
2166
+ },
2167
+ "postal" : {
2168
+ "code" : "23100",
2169
+ "confidence" : 30
2170
+ },
2171
+ "registered_country" : {
2172
+ "geoname_id" : 298795,
2173
+ "iso_code" : "TR",
2174
+ "names" : {
2175
+ "de" : "Türkei",
2176
+ "en" : "Turkey",
2177
+ "es" : "Turquía",
2178
+ "fr" : "Turquie",
2179
+ "ja" : "トルコ共和国",
2180
+ "pt-BR" : "Turquia",
2181
+ "ru" : "Турция",
2182
+ "zh-CN" : "土耳其"
2183
+ }
2184
+ },
2185
+ "subdivisions" : [
2186
+ {
2187
+ "confidence" : 60,
2188
+ "geoname_id" : 315807,
2189
+ "iso_code" : "23",
2190
+ "names" : {
2191
+ "en" : "Elazığ"
2192
+ }
2193
+ }
2194
+ ],
2195
+ "traits" : {
2196
+ "autonomous_system_number" : 8517,
2197
+ "autonomous_system_organization" : "National Academic Network and Information Center",
2198
+ "connection_type" : "Cable/DSL",
2199
+ "isp" : "National Academic Network and Information Center",
2200
+ "organization" : "National Academic Network and Information Center",
2201
+ "user_type" : "business"
2202
+ }
2203
+ }
2017
2204
  }
2018
2205
  ]