A module for CZIP address library qqwry.dat, which can perform isp query and convert .dat files into json files, which can be directly imported into MongoDB, etc.
LimQqwry requires Node.js v6.0.0 or higher for ES2015 and async function support.
npm install lim-qqwry
Example
importLimQqwryfrom"lim-qqwry";importpathfrom"path";importfsfrom"fs";constdatapath=path.join(__dirname,"./qqwry.dat");constqqwry=newLimQqwry(datapath);// query ip informationconstipdata=qqwry.searchIP("115.120.105.66");console.log(ipdata);// convert to jsonconstresult=qqwry.toJson(datapath);fs.writeFile("./data.json",JSON.stringify(result),()=>{console.log("succeed!");});
Note that when creating a new instance, the module will read the .dat file into the memory to improve the speed of subsequent operations (extreme speed mode in the original code), so if it is a one-time conversion instead of query services, please pay attention to the memory overflow problem.
Other
Used with MongoDB, you can store StartIpIntList instead of qqwry.dat in memory all the time, get queryIp through the provided static method, and go to the database to query:
The Tidelift Subscription provides access to a continuously curated stream of human-researched and maintainer-verified data on open source packages and their licenses, releases, vulnerabilities, and development practices.