geoip
Manage GeoLite2 MMDB assets and inspect GeoIP lookup configuration.
xrat geoip <command> [flags]
Subcommands
| Command | Description |
|---|---|
download | Download one or more GeoLite2 MMDB editions |
update | Refresh all supported GeoLite2 MMDB editions |
path | Print the resolved MMDB directory |
status | Show MMDB presence and size for each supported edition |
lookup | Look up a single IP through the configured GeoIP backend |
backend | Print the active GeoIP backend configuration |
download
Download one or more GeoLite2 MMDB editions.
xrat geoip download [flags]
| Flag | Description |
|---|---|
--edition <name> | Edition to download. Repeatable: GeoLite2-Country, GeoLite2-City, GeoLite2-ASN or country, city, asn |
--all | Download all supported editions |
--output <dir> | Override the MMDB target directory for this command |
--force | Re-download even when the destination file already exists |
--url <url> | Override the download URL template. Use {edition} as a placeholder |
--timeout <secs> | Override the HTTP request timeout in seconds |
--quiet | Suppress progress bar output |
If neither --edition nor --all is given, the configured default_editions
from [mmdb] are used.
Examples
Download all editions to the default MMDB directory:
xrat geoip download --all
Download a single edition:
xrat geoip download --edition city
Download to a custom directory:
xrat geoip download --all --output ./testdata/xrat/mmdb
update
Refresh all supported GeoLite2 MMDB editions. Equivalent to
download --all --force.
xrat geoip update [flags]
| Flag | Description |
|---|---|
--output <dir> | Override the MMDB target directory for this command |
--url <url> | Override the download URL template. Use {edition} as a placeholder |
--timeout <secs> | Override the HTTP request timeout in seconds |
--quiet | Suppress progress bar output |
Example
xrat geoip update
path
Print the resolved MMDB directory.
xrat geoip path [flags]
| Flag | Description |
|---|---|
--output <dir> | Override the MMDB target directory for this command |
Resolution order:
--outputflag, if provided[mmdb].dirfrom config (resolved relative toXRAT_PATHor config file location)- Default:
~/.config/xrat/mmdb
Examples
xrat geoip path
xrat geoip path --output /custom/path
status
Show MMDB presence and size for each supported edition.
xrat geoip status [flags]
| Flag | Description |
|---|---|
--output <dir> | Override the MMDB target directory for this command |
--strict | Exit non-zero when any supported edition is missing |
Example
xrat geoip status --strict
lookup
Look up a single IP address through the configured GeoIP backend.
xrat geoip lookup <ip> [flags]
| Argument | Description |
|---|---|
ip | IP address to look up |
| Flag | Description |
|---|---|
--backend <name> | Override backend: mmdb, ipwhois, ip-api |
--no-cache | Bypass the configured in-memory cache for this invocation |
--json | Print the lookup result as JSON |
The lookup returns country code, city/region, and ASN information when available.
Examples
xrat geoip lookup 8.8.8.8
xrat geoip lookup 8.8.8.8 --backend ipwhois
xrat geoip lookup 2001:4860:4860::8888 --json
backend
Print the active GeoIP backend configuration.
xrat geoip backend [flags]
| Flag | Description |
|---|---|
--backend <name> | Override backend: mmdb, ipwhois, ip-api |
--no-cache | Describe the backend chain without cache wrapping |
Shows the backend type, configured fallback, rate limiting, and cache settings.
Example
xrat geoip backend
Troubleshooting
If geoip status --strict reports missing files, download the supported MMDB
editions:
xrat geoip download --all
If MMDB lookup fails but remote lookup works, check the resolved directory:
xrat geoip path
xrat geoip lookup 8.8.8.8 --backend ipwhois
Remote backends can be rate-limited by the provider. Use the default cache
unless you specifically need --no-cache for diagnostics.
Related
[mmdb]config โ MMDB asset configuration[testing.geoip]config โ GeoIP lookup backend configuration- GeoIP Enrichment โ test result enrichment feature