A 99.9% accurate offline IP address location database

A 99.9% accurate offline IP address location database

2022-09-05 0 885
Resource Number 38078 Last Updated 2025-02-24
¥ 0HKD Upgrade VIP
Download Now Matters needing attention
Can't download? Please contact customer service to submit a link error!
Value-added Service: Installation Guide Environment Configuration Secondary Development Template Modification Source Code Installation

This issue features an open-source offline IP address location library called Ip2region.

A 99.9% accurate offline IP address location database插图

Ip2region is an offline IP address location library with an accuracy rate of up to 99.9%, and a search performance of 0.0x milliseconds. The DB file is only a few megabytes in size, which stores all IP addresses. It supports queries for binding in Java, PHP, C, Python, Node.js, Go, C#, and Lua. The query algorithm uses binary trees, B-trees, and in-memory search algorithms.

functional characteristics

  • Query accuracy up to 99.9%

The data comes from some well-known IP query providers and has been tested to be more accurate than pure IP positioning.

  • >80%, Taobao IP address library: http://ip.taobao.com
  • ≈10%,GeoIP: https://geoip.com
  • ≈2%,Pure IP Library: http://www.cz88.net
  • Small file size

The database file ip2region.db is only a few MB in size, with the smallest version not exceeding 1.5MB and the largest not exceeding 8MB.

  • standard data format

Each IP data segment has a fixed format, and currently only domestic data can be accurately located at the city level. For other countries, only a portion can be located at the country level, and the default value for data that cannot be confirmed is 0.

_City ID | Country | Region | Province | City | ISP_
  • Fast query speed

All client queries are at the 0. x millisecond level and come with three built-in query algorithms:

  • Memory algorithm: The entire database is loaded into memory, and a single query occurs within 0.1x milliseconds. For C language clients, a single query occurs at the 0.00x millisecond level.
  • Binary algorithm: based on binary search, based on the ip2region.db file, does not require loading into memory, and a single query takes 0. x milliseconds.
  • B-tree algorithm: Based on the BTree algorithm and the ip2region.db file, it does not require loading into memory and word queries are faster than binary algorithms at the 0. x millisecond level.
  • Support for multiple query clients

The client has integrated Java, C #, PHP, C, Python, NodeJS, PHP extensions (PHP5 and PHP7), Golang, Rust, Lua, Lua_c, and nginx.

7986470e5baa4f5685fb90be1c2b9b44noop.image_

Quick installation

  • Maven warehouse address
<dependency>
    <groupId>org.lionsoul</groupId>
    <artifactId>ip2region</artifactId>
    <version>1.7.2</version>
</dependency>
  • nodejs
npm install node-ip2region --save
  • Nuget installation
Install-Package IP2Region
  • php composer
composer require zoujingli/ip2region

Quick testing

Please refer to the README instructions under each binding to run the CLI test program. For example, the demo in C language runs as follows:

cd binding/c/
gcc -g -O2 testSearcher.c ip2region.c
./a.out ../../data/ip2region.db

You will see the following CLI interface:

initializing  B-tree ... 
+----------------------------------+
| ip2region test scripA 99.9% accurate offline IP address location database插图2t            |
| Author: chenxin619315@gmail.com  |
| Type 'quit' to exit program      |
+----------------------------------+
p2region>> 101.105.35.57
2163 | China | South China | Guangdong Province | Shenzhen City | Dr. Peng in 0.02295 milliseconds

Enter the IP address to start testing. The first time may be a bit slow. After running the command, connect binary and memory to try other algorithms. It is recommended to use the b-tree algorithm. For speed and concurrency requirements, the memory algorithm can be used. Please refer to the testing source code under different bindings for specific integration.

资源下载此资源为免费资源立即下载
Telegram:@John_Software

Disclaimer: This article is published by a third party and represents the views of the author only and has nothing to do with this website. This site does not make any guarantee or commitment to the authenticity, completeness and timeliness of this article and all or part of its content, please readers for reference only, and please verify the relevant content. The publication or republication of articles by this website for the purpose of conveying more information does not mean that it endorses its views or confirms its description, nor does it mean that this website is responsible for its authenticity.

Ictcoder Free Source Code A 99.9% accurate offline IP address location database https://ictcoder.com/a-99-9-accurate-offline-ip-address-location-database/

Share free open-source source code

Q&A
  • 1. Automatic: After making an online payment, click the (Download) link to download the source code; 2. Manual: Contact the seller or the official to check if the template is consistent. Then, place an order and make payment online. The seller ships the goods, and both parties inspect and confirm that there are no issues. ICTcoder will then settle the payment for the seller. Note: Please ensure to place your order and make payment through ICTcoder. If you do not place your order and make payment through ICTcoder, and the seller sends fake source code or encounters any issues, ICTcoder will not assist in resolving them, nor can we guarantee your funds!
View details
  • 1. Default transaction cycle for source code: The seller manually ships the goods within 1-3 days. The amount paid by the user will be held in escrow by ICTcoder until 7 days after the transaction is completed and both parties confirm that there are no issues. ICTcoder will then settle with the seller. In case of any disputes, ICTcoder will have staff to assist in handling until the dispute is resolved or a refund is made! If the buyer places an order and makes payment not through ICTcoder, any issues and disputes have nothing to do with ICTcoder, and ICTcoder will not be responsible for any liabilities!
View details
  • 1. ICTcoder will permanently archive the transaction process between both parties and snapshots of the traded goods to ensure the authenticity, validity, and security of the transaction! 2. ICTcoder cannot guarantee services such as "permanent package updates" and "permanent technical support" after the merchant's commitment. Buyers are advised to identify these services on their own. If necessary, they can contact ICTcoder for assistance; 3. When both website demonstration and image demonstration exist in the source code, and the text descriptions of the website and images are inconsistent, the text description of the image shall prevail as the basis for dispute resolution (excluding special statements or agreements); 4. If there is no statement such as "no legal basis for refund" or similar content, any indication on the product that "once sold, no refunds will be supported" or other similar declarations shall be deemed invalid; 5. Before the buyer places an order and makes payment, the transaction details agreed upon by both parties via WhatsApp or email can also serve as the basis for dispute resolution (in case of any inconsistency between the agreement and the description of the conflict, the agreement shall prevail); 6. Since chat records and email records can serve as the basis for dispute resolution, both parties should only communicate with each other through the contact information left on the system when contacting each other, in order to prevent the other party from denying their own commitments. 7. Although the probability of disputes is low, it is essential to retain important information such as chat records, text messages, and email records, in case a dispute arises, so that ICTcoder can intervene quickly.
View details
  • 1. As a third-party intermediary platform, ICTcoder solely protects transaction security and the rights and interests of both buyers and sellers based on the transaction contract (product description, agreed content before the transaction); 2. For online trading projects not on the ICTcoder platform, any consequences are unrelated to this platform; regardless of the reason why the seller requests an offline transaction, please contact the administrator to report.
View details

Related Source code

ICTcoder Customer Service

24-hour online professional services