7 ms·
Another solution is to use an MMDB (“MaxMind DB”) file [1] which is essentially a binary tree + deduplicated values (same as idea 3.1). There are several free
by maxmouchet 2y ago
Another solution is to use an MMDB (“MaxMind DB”) file [1] which is essentially a binary tree + deduplicated values (same as idea 3.1).
There are several free ASN MMDBs [2,3] but you can also build your own MMDB files from any Prefix->Value mapping with the mmdbwriter library [4] or a CLI tool built on top of it like mmdbctl [5].
Assuming the ASN MMDB is fully loaded in memory, it would use around 60MB.
[1] https://maxmind.github.io/MaxMind-DB/ https://maxmind.github.io/MaxMind-DB/
[2] https://dev.maxmind.com/geoip/docs/databases/asn/ https://dev.maxmind.com/geoip/docs/databases/asn/
[3] https://ipinfo.io/products/free-ip-data-downloads https://ipinfo.io/products/free-ip-data-downloads
[4] https://github.com/maxmind/mmdbwriter https://github.com/maxmind/mmdbwriter
[5] https://github.com/ipinfo/mmdbctl https://github.com/ipinfo/mmdbctl
(I work for IPinfo, but there are lots of other companies offering MMDB files).
- seligman99 2y agoThis is the same idea I used for my Cloud IP lookup tool [1], lets it all work in browser with a small file to search against [1] https://cloud-ips.s3-us-west-2.amazonaws.com/index.html https://cloud-ips.s3-us-west-2.amazonaws.com/index.html
- maxmouchet 2y agoOh this is nice, and a cool use of HTTP range requests!
- ignoramous 2y agoOh, then you'll love: Hosting SQLite databases on GitHub Pages or any static file hoster (2021), https://news.ycombinator.com/item?id=27016630 https://news.ycombinator.com/item?id=27016630
- zdyxry 2y agocool
- mattpallissard 2y ago"MaxMouchet DB"
- gallypette 2y agohttps://github.com/adulau/mmdb-server https://github.com/adulau/mmdb-server