The data source of the input data comes from networks field in GeoIP2/GeoLite2, such as “5.157.15.0/24”. It can be represented by 37bit. It is divided into two parts here: netHigh16 and netLow21.
- netHigh16: Its low 32bit stores its starting line in the file, and its high 32bit stores its starting position in netLow21.
- netLow21: Its storage is divided into two situations. When the number of netLow21 corresponding to one netHigh16 is less than the threshold, it is stored in a 512bit array tightly. If it is greater than the threshold, the index is stored first, and then the content.
For more details, please refer to the source code.