Geo 数据
mihomo 自带四个地理数据文件的内置下载 URL,用于路由规则 (GEOIP、GEOSITE、ASN 匹配)。可用 geox-url 覆盖其中任一项。 下方的四个 geo-* 顶层键控制刷新与加载器行为。
geox-url
| 字段 | 类型 | 默认值 | 允许值 | 描述 |
|---|---|---|---|---|
geoip | string | (built-in) | <URL> | 二进制 GeoIP 数据库(geoip.dat)的下载 URL。 |
mmdb | string | (built-in) | <URL> | MaxMind 格式数据库(Country.mmdb)的下载 URL。 |
asn | string | (built-in) | <URL> | ASN 数据库(供 `GEOSITE,asn:...` 规则使用)的下载 URL。 |
geosite | string | (built-in) | <URL> | GeoSite 域名分类数据库(geosite.dat)的下载 URL。 |
源码: config/config.go:357-362 · 锚定版本 v1.19.27 (5184081)
顶层键
| 字段 | 类型 | 默认值 | 允许值 | 描述 |
|---|---|---|---|---|
geo-auto-update | bool | false | true | false | 启动时以及每个 geo-update-interval 刷新这四个 geo 文件。 |
geo-update-interval | int | 24 | <hours> | 启用 geo-auto-update 时的刷新间隔,单位小时。 |
geodata-mode | bool | (build default) | true | false | 使用二进制 `geoip.dat` 替代 MaxMind 的 `Country.mmdb`。构建时默认值因平台而异。 |
geodata-loader | string | memconservative | memconservative | standard | 加载器实现。`memconservative` 占用更小的常驻内存;`standard` 首次命中更快。 |
geosite-matcher | string | (loader default) | hybrid | succinct | GeoSite 数据库使用的域名匹配算法。 |
源码: config/config.go:393-460 · 锚定版本 v1.19.27 (5184081)
示例
yaml
geo-auto-update: true
geo-update-interval: 24
geodata-mode: true
geodata-loader: memconservative
geosite-matcher: succinct
geox-url:
geoip: https://example.com/geoip.dat
mmdb: https://example.com/Country.mmdb
asn: https://example.com/GeoLite2-ASN.mmdb
geosite: https://example.com/geosite.dat说明
- 未启用
geo-auto-update时,这四个文件在首次使用时才会被懒拉取。 - 切换
geodata-mode会改变GEOIP规则查询的文件:true用geoip.dat,false用Country.mmdb。ASN 与 GeoSite 文件不受 影响。
源码: config/config.go:357-460 · v1.19.27 (5184081)
