{"_id":"302","_rev":"4-6de5a2781c3ab11340cf05417274a435","name":"302","description":"Ip location query.","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"302","version":"0.0.1","description":"Ip location query.","dependencies":{"debug":"0.8.0","iconv-lite":"0.2.11"},"devDependencies":{"autod":"*","benchmark":"*","contributors":"*","cov":"*","istanbul-harmony":"*","jshint":"*","mocha":"*","should":"3.2.0"},"main":"index","scripts":{"test":"make test"},"config":{"alicov":{"threshold":100}},"homepage":"https://github.com/leoner/iputil","repository":{"type":"git","url":"git@github.com:leoner/iputil.git"},"bugs":{"url":"https://github.com/leoner/iputil/issues"},"_id":"302@0.0.1","dist":{"shasum":"1b3169c4f00dca8bc5c757229c1a410fb77d5682","tarball":"https://registry.npmjs.org/302/-/302-0.0.1.tgz","integrity":"sha512-Lua94QgagZt068SjdYH2IFrdJS+o0bEVttiTx3LnEgxjB5bHeR2WTw3YOWV3Gk/ELCmjg2dR7RL3LPz/g8Hvdw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNviyfgxadzw9P1EBstCzpMbWASgvKScm6xA+zSqP4OQIhANtcxW+6hqWrUHDawIXZcrbeG9uPLGvoSXo9UYrfoZya"}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"kangpangpang","email":"kangpangpang@gmail.com"},"maintainers":[{"name":"kangpangpang","email":"kangpangpang@gmail.com"}]}},"readme":"iputil\n======\n\n查询指定 ip 所在地.\n### 支持的 IP 数据格式\n\n```\n10.5.18.0, 10.5.18.255, 中国, 福建, null, 中国福建省\n10.5.0.0, 10.5.255.255, 中国, 福建, 福州, 中国福建省\n1.0.0.0, 1.0.0.255, 澳大利亚, null, null, 澳大利亚\n1.0.1.0, 1.0.3.255, 中国, 福建, null, 中国福建省\n1.0.4.0, 1.0.7.255, 澳大利亚, null, null, 澳大利亚\n1.0.8.0, 1.0.15.255, 中国, 广东, null, 中国广东省\n```\n\n### 使用\n\n```\nvar IpUtil = require('iputil');\n\nipUtil = new IpUtil('ip-utf8.txt', 'utf8');\n\nipUtil.getIpInfo('1.12.0.0').country; // 中国\nipUtil.getIpInfo('1.12.0.0').province; // 北京\nipUtil.getIpInfo('1.12.0.0').city; // 北京   );\n\nipUtil_gbk = new IpUtil('ip-gbk.txt');\n\nipUtil_gbk.getIpInfo('1.12.0.0').country; // 中国\nipUtil_gbk.getIpInfo('1.12.0.0').province; // 北京\nipUtil_gbk.getIpInfo('1.12.0.0').city; // 北京 ;\n\n```\n\n### 注意\n用到了 es6 的生成器, 所以需要使用 node 0.11.x 以上的版本.\n\n### Benchmark\n\n```bash\n$ node benchmark.js\niniting iputil\ndone, use 9088 ms\niputil.getIpInfo(\"115.193.152.250\"): {\"startIp\":1942067200,\"endIp\":1942067455,\"country\":\"中国\",\"province\":\"浙江\",\"city\":\"杭州\",\"address\":\"中国浙江省杭州市萧山区\"}\niputil.getIpInfo(\"222.73.68.35\"): {\"startIp\":3729342720,\"endIp\":3729343999,\"country\":\"中国\",\"province\":\"上海\",\"city\":\"上海\",\"address\":\"中国上海市浦东区\"}\niputil.getIpInfo(\"220.191.113.36\"): {\"startIp\":3703533568,\"endIp\":3703534591,\"country\":\"中国\",\"province\":\"浙江\",\"city\":\"杭州\",\"address\":\"中国浙江省杭州市萧山区\"}\niputil.getIpInfo() one ip x 698,317 ops/sec ±2.01% (92 runs sampled)\nFastest is iputil.getIpInfo() one ip\n```\n","maintainers":[{"name":"kangpangpang","email":"kangpangpang@gmail.com"}],"time":{"modified":"2022-06-12T14:07:09.487Z","created":"2014-04-21T07:46:27.234Z","0.0.1":"2014-04-21T07:46:27.234Z"},"homepage":"https://github.com/leoner/iputil","repository":{"type":"git","url":"git@github.com:leoner/iputil.git"},"bugs":{"url":"https://github.com/leoner/iputil/issues"},"readmeFilename":"README.md"}