Code Monkey home page Code Monkey logo

Comments (1)

sjzar avatar sjzar commented on August 18, 2024

很高兴这个项目能够帮助到你 :)

关于你提到的海内外使用不同 IP 库的需求,由于 “国家” 字段同样是 IP 数据库内容的一部分,不同数据库的信息会存在差异,所以基于任一 IP 数据库做海内外判断都可能有误差。

我的建议是尝试用 hybrid-mode 同时查询两个数据库的信息,并自行实现业务逻辑判断。
请参考相关文档:https://github.com/sjzar/ips/blob/main/docs/config.md#hybrid_mode

示例:
1. 下载 qqwry.dat & GeoLite2 数据库
    ips download qqwry.dat
    ips download GeoLite2-City.mmdb

2. 使用 hybrid-mode 查询 2 个数据库
    ips -i .ips/qqwry.dat -i .ips/GeoLite2-City.mmdb 12.12.12.12 -f '*' -j
    {"items":[{"ip":"12.12.12.12","net":"12.11.140.0/22","data":{"0_country":"美国","0_isp":"AT","1_accuracy_radius":"1000","1_city":"","1_continent":"北美洲","1_country":"美国","1_latitude":"37.751000","1_longitude":"-97.822000","1_province":"","1_registered_country":"美国","1_utcOffset":"America/Chicago"}}]}

    ips -i .ips/qqwry.dat -i .ips/GeoLite2-City.mmdb -f '*'  123.123.123.123 -j
    {"items":[{"ip":"123.123.123.123","net":"123.123.123.0/24","data":{"0_country":"**","0_isp":"联通","1_accuracy_radius":"1000","1_city":"北京","1_continent":"亚洲","1_country":"**","1_latitude":"39.911000","1_longitude":"116.395000","1_province":"北京","1_registered_country":"**","1_utcOffset":"Asia/Shanghai"}}]}

命令中的多个 -i 参数会同时生效,使用 -f '*' 检查所有的数据库字段,第一个数据库的字段以 0_ 作为前缀,第二个数据库的字段以 1_ 作为前缀。

希望可以帮助到你~

from ips.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.