Input: IP address ——— > output: This IP address in the country, place names, and sometimes even fine to the floor.
The IP database on the network is the most popular with the pure version, LUMAQQ also uses the pure version IP database as the basis of the IP query function. However, the document on its format is very few, and then finally found several documents on the Internet, only to know its inside, now my understanding of the QQWRY.DAT data structure of the show. Let more people understand the inside of it.
detailed deconstruction:
1. qq.dat Data storage format:
1.2 Explain in detail three large chunks:
1.2.1 First Block: file header
The header of the file is 8 byte length, the first four bytes store the absolute address of the second index, and the last four bytes store the absolute address of the final index.
1.2.2 Second BLOCK: Index area:
The index area format is shown below:
First say the IP address of the start IP and end IP. For example: China, the United States, Britain each country has a different IP segment, IP segment is composed of the start IP and end IP, from the beginning IP to the end of IP in all IP on the composition of what we call the IP segment. Like what:
010.018.132.000 010.018.132.255 [Hebei] [Chengde 169 users]
010.018.160.000 010.018.255.255 [Hebei] [Tangshan]
Again, the storage structure of the index area, which stores a number of indexes, the format of each index is 7 bytes, the first four bytes represents the starting byte of an IP segment, and the last three bytes are the addresses of all IP records that are linked to the IP segment starting with this starting IP, which means that it is an absolute address, Used to link to the record area to query the country, the region's data.
1.2.3 Third block: Record area:
The data format of the record area is indefinite and the data is mainly of the following types:
B: National records (ends at 0x 00)
C: Regional records (end at 0x 00)
D: Identifying characters:
The above is my reference to the Internet, after the explanation of prawns, according to their own understanding and feelings, the problem again explained in detail, I hope to help.
Attached: This picture is for reference
Current 1/2 page
12 Next read the full text