Loyalsoldier / geoip

🌚 🌍 🌝 GeoIP 规则文件加强版,同时支持定制 V2Ray dat 格式路由规则文件 geoip.dat 和 MaxMind mmdb 格式文件 Country.mmdb。Enhanced edition of GeoIP files for V2Ray, Xray-core, Clash, Trojan-Go, Leaf and Hysteria, with replaced CN IPv4 CIDR available from ipip.net, appended CIDR lists and more.
Creative Commons Attribution Share Alike 4.0 International
3.37k stars 598 forks source link

请问可以考虑支持db-ip的数据库吗? #146

Closed MaurUppi closed 6 months ago

MaurUppi commented 6 months ago

https://github.com/cnartlu/geoip2/issues/1#issuecomment-1865975263

用下来,感觉 DB-IP ip-to-city-lite 比MaxMind GeoLite2-City数据质量更好,也丰富

Loyalsoldier commented 6 months ago

目前没有这个打算。你可以借助本项目,构建自己的数据库文件,参考本项目 README。

MaurUppi commented 6 months ago

目前没有这个打算。你可以借助本项目,构建自己的数据库文件,参考本项目 README。

虽然Issue closed 但,可否询问一下,当前项目程序是否同样支持 db-ip的CSV或者mmdb呢?

https://db-ip.com/db/download/ip-to-country-lite

image

Loyalsoldier commented 6 months ago

支持 MaxMind 的 MMDB 格式作为输入端(input)

MaurUppi commented 6 months ago

支持 MaxMind 的 MMDB 格式作为输入端(input)

我看到 plugin/maxmind/mmdb_in.go 有用到 github.com/oschwald/maxminddb-golang 库,这个是库是可以支持读取db-IP mmdb的。

另外config.json只有 maxmindGeoLite2CountryCSV ,mmdb格式是否更改为 maxmindGeoLite2CountryMMDB还是怎样?

    {
      "type": "maxmindGeoLite2CountryCSV",
      "action": "add",
      "args": {
        "country": "./geolite2/GeoLite2-Country-Locations-en.csv",
        "ipv4": "./geolite2/GeoLite2-Country-Blocks-IPv4.csv",
        "ipv6": "./geolite2/GeoLite2-Country-Blocks-IPv6.csv"
      }
    }
import (
    "encoding/json"
    "fmt"
    "io"
    "net/http"
    "os"
    "path/filepath"
    "strings"

    "github.com/Loyalsoldier/geoip/lib"
    "github.com/oschwald/maxminddb-golang"
)
Loyalsoldier commented 6 months ago

配置参考:https://github.com/Loyalsoldier/geoip/blob/bf51d6afac442fec800bb15f2d7545a1e3bba262/config-example.json#L30-L58

JohnnySun commented 6 months ago

@MaurUppi 我这边有一份替换maxmind数据库为ipinfo.io 数据库的commit修改 你可以拿去用,准确度比maxmind的数据准确很多

https://github.com/JohnnySun/geoip/commit/b4f6f9b7f0e8409fa1f84e0883172adfa1aa8484