Skip to content

Geodata — Xray-core

geodata is a top-level block that keeps Xray's external data files — geoip.dat and geosite.dat, the files behind geoip: / geosite: routing and DNS rules — automatically up to date. Each asset is downloaded from an HTTPS url into a local file, optionally on a cron schedule and through a chosen outbound.

Options

FieldTypeDefaultAllowed valuesDescription
cron*string(no schedule)<cron expression>Standard 5-field cron expression controlling how often assets are refreshed. Omit to disable scheduled updates.
outboundstring(default routing)<outbound tag>Tag of the outbound used to download assets, so updates can go through a proxy instead of direct.
assets[]*GeodataAssetConfig[][GeodataAssetConfig]Assets to fetch and keep up to date.

Source: infra/conf/geodata.go:42-46 · pinned at v26.6.1 (94ffd50)

assets[]

FieldTypeDefaultAllowed valuesDescription
urlstring(required)https://…Source URL. Must be HTTPS — any other scheme is rejected at config build.
filestring(required)<file name>Local asset file to write and load. Must resolve on Xray's asset search path.

Source: infra/conf/geodata.go:13-16 · pinned at v26.6.1 (94ffd50)

Example

Refresh geoip.dat and geosite.dat every day at 04:00, downloading through the proxy outbound:

json
{
  "geodata": {
    "cron": "0 4 * * *",
    "outbound": "proxy",
    "assets": [
      {
        "url": "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geoip.dat",
        "file": "geoip.dat"
      },
      {
        "url": "https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/geosite.dat",
        "file": "geosite.dat"
      }
    ]
  }
}

Notes

  • url must be HTTPS; any other scheme fails at config build.
  • file must resolve on Xray's asset search path (the directory alongside the binary, or the path set by XRAY_LOCATION_ASSET). These are the same file names that geoip: / geosite: rules load.
  • cron uses standard 5-field cron syntax; an invalid expression is a startup error. Omit cron to disable scheduled refresh.
  • The categories inside these files (cn, private, apple, …) drive routing — see the Routing page.

Cross-core notes

  • mihomo configures the equivalent through the top-level geox-url block (asset URLs) plus geo-auto-update / geo-update-interval. See GeoX URL — mihomo.
  • sing-box fetches rule-sets on demand via route.rule_set instead of maintaining .dat files, so it has no direct equivalent.

Source: infra/conf/geodata.go:13-46 · v26.6.1 (94ffd50)

Core Tutorial by Argsment