Overview of ip-location-db
maincountry, city, and asn. All databases follow a standard format for their respective types.repository·main·Indexed 24 days ago
https://github.com/sapics/ip-location-dbA repository providing IP-to-location mapping data in CSV and MMDB formats. It offers three main database types: country, city, and ASN (Autonomous System Number). The project includes datasets such as geolite2-city, dbip-city, user-country, server-country, and origin-asn, with varying licenses including PDDL, CC BY 4.0, and CC BY-SA 4.0.
country, city, and asn. All databases follow a standard format for their respective types.user-country, server-country, and origin-asn are published under the PDDL license. This allows for free use without attribution. These datasets are compiled from raw, public network data to ensure they remain free of commercial or redistribution restrictions.The datasets are compiled using the following types of public network data:
geofeeds published by network operators (RFC 8805 / RFC 9632).inetnum, country, or geoloc) for geographic mapping. This avoids violations of RIR policies (e.g., APNIC's prohibition on using WHOIS to map IP addresses to geographic locations). Instead, the project relies exclusively on open routing records and public geofeeds.Both user-country and server-country use the same data sources but prioritize different geographic points:
user-country (Recommended): Prioritizes the end-user's country, even when routed through VPNs or proxies. This is best for most general applications.server-country: Prioritizes the physical server or relay point. This is best for specific network analysis, such as determining routing locations.In most instances, both databases return almost identical results.
The project provides several databases depending on your requirements for accuracy, data type, and licensing. Use the following recommendations to select a database:
geolite2-city.dbip-city.user-country.origin-asn.SHA-256 checksum files are available for all release assets in the Checksum Release.
To construct a checksum URL for a specific file, replace /download/latest/ in the file's download URL with /download/checksum/ and append .sha256 to the filename.
Example:
https://github.com/sapics/ip-location-db/releases/download/latest/user-country-ipv4.csvhttps://github.com/sapics/ip-location-db/releases/download/checksum/user-country-ipv4.csv.sha256GeoLite2 (provided by MaxMind) is licensed under CC BY-SA 4.0. If you use these databases, you must adhere to specific restrictions and obligations, including:
It is highly recommended to read the GEOLITE2_LICENSE and GEOLITE2_EULA files before use.
The dbip databases are licensed under CC BY 4.0. If you use these in a web application, you must include a link back to DB-IP.com on pages that display or use the results.
You can satisfy this requirement by pasting the following HTML snippet into your code:
<a href='https://db-ip.com/'>IP Geolocation by DB-IP</a>
<a href='https://db-ip.com/'>IP Geolocation by DB-IP</a>If you are integrating MMDB files into an existing project, you can use various libraries depending on your language:
To create your own MMDB files from CSV files (for custom formats), use:
City databases use the following CSV structure:
ip_range_start, ip_range_end, country_code, state1, state2, city, postcode, latitude, longitude, timezoneASN (Autonomous System Number) databases use the following CSV structure:
ip_range_start, ip_range_end, autonomous_system_number, autonomous_system_organization