Git project recommendation | ip address ing library ip2region-ip address to the region ing library. mom no longer needs to worry about my ip address location.
1. 99.9% accuracy, occasionally updated:
Data aggregates data from some well-known ip addresses to geographical name query providers. these are their official accuracy rates, which are much more accurate than pure ones. It takes one to two days for each aggregated data to be updated from time to time.
2. standardized data format:
The format of each ip data segment is fixed: _ City Id | country | region | province | city | ISP _
Only China's data is accurate to the city, and other countries can only locate the country. the previous options are all 0, and all the countries you can find are included.
(Ignore the previous City Id and personal project requirements)
3. small size:
The generated database file ip2region. db is only 3.5 MB
4. support for multi-query clients: query in milliseconds of 0.0x
Integrated clients include java, php, c, python, and php extensions (currently only linux is supported ).
Two query algorithms are provided. the response time is as follows: client/binary algorithm/B-tree algorithm: java/0. x millisecond/0. x millisecond (using RandomAccessFile) php/0. x millisecond/0.1x millisecond c/0.0x millisecond/0.0x millisecond (B-tree algorithm is basically stable at 0.02x millisecond level) python/0. x millisecond/0.1x millisecond
Any client B-tree is faster than the binary algorithm
5. test program: java:
cd binding/java ant all java -jar ip2region-{version}.jar ./data/ip2region.db
Php:
php binding/php/testSearcher ./data/ip2region.db
C:
cd binding/c/ gcc -g -O2 testSearcher.c ip2region.c ./a.out ../../data/ip2region.db
Python:
python binding/python/testSearcher ./data/ip2region.db
The following page is displayed:
Initializing B-tree... + ---------------------------------- + | ip2region test script | Author: chenxin619315@gmail.com | Type 'quit' to exit program | + ---------------------------------- + p2region> 101.105.35.572163 | China | South China | Guangdong province | Shenzhen City | Dr. Peng in 0.02295 millseconds
Enter the IP address to start the test. The first test will be a little slow. after running the command, access binary to try the binary algorithm. we recommend that you use the B-tree algorithm.
For specific integration, see the test source code of different clients.
6. contact author:
The soul of the lion: chenxin619315@gmail.com