Skip to content

Geo Data

mihomo ships with built-in URLs for the four geographical-data files it uses for routing rules (GEOIP, GEOSITE, ASN matches). Override any of them with geox-url. The four geo-* top-level keys below tune refreshing and loader behavior.

geox-url

FieldTypeDefaultAllowed valuesDescription
geoipstring(built-in)<URL>Download URL for the binary GeoIP database (geoip.dat).
mmdbstring(built-in)<URL>Download URL for the MaxMind-format database (Country.mmdb).
asnstring(built-in)<URL>Download URL for the ASN database (used by `GEOSITE,asn:...` rules).
geositestring(built-in)<URL>Download URL for the GeoSite domain-tag database (geosite.dat).

Source: config/config.go:357-362 · pinned at v1.19.27 (5184081)

Top-level keys

FieldTypeDefaultAllowed valuesDescription
geo-auto-updateboolfalsetrue | falseRefresh the four geo files on startup and at every geo-update-interval.
geo-update-intervalint24<hours>Refresh interval in hours when geo-auto-update is on.
geodata-modebool(build default)true | falseUse the binary `geoip.dat` instead of the MaxMind `Country.mmdb`. The build-time default is platform-dependent.
geodata-loaderstringmemconservativememconservative | standardLoader implementation. `memconservative` keeps a smaller resident set; `standard` is faster at first match.
geosite-matcherstring(loader default)hybrid | succinctDomain-matching algorithm for the GeoSite database.

Source: config/config.go:393-460 · pinned at v1.19.27 (5184081)

Example

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

Notes

  • The four files are fetched lazily on first use unless geo-auto-update is enabled.
  • Switching geodata-mode swaps which file is consulted for GEOIP rules: true uses geoip.dat, false uses Country.mmdb. The ASN and GeoSite files are not affected.

Source: config/config.go:357-460 · v1.19.27 (5184081)

Core Tutorial by Argsment