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
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
cron | *string | (no schedule) | <cron expression> | Standard 5-field cron expression controlling how often assets are refreshed. Omit to disable scheduled updates. |
outbound | string | (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[]
| Field | Type | Default | Allowed values | Description |
|---|---|---|---|---|
url | string | (required) | https://… | Source URL. Must be HTTPS — any other scheme is rejected at config build. |
file | string | (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
urlmust be HTTPS; any other scheme fails at config build.filemust resolve on Xray's asset search path (the directory alongside the binary, or the path set byXRAY_LOCATION_ASSET). These are the same file names thatgeoip:/geosite:rules load.cronuses standard 5-field cron syntax; an invalid expression is a startup error. Omitcronto 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-urlblock (asset URLs) plusgeo-auto-update/geo-update-interval. See GeoX URL — mihomo. - sing-box fetches rule-sets on demand via
route.rule_setinstead of maintaining.datfiles, so it has no direct equivalent.
Source: infra/conf/geodata.go:13-46 · v26.6.1 (94ffd50)
