Keyboard shortcuts

Press โ† or โ†’ to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

geoip

Manage GeoLite2 MMDB assets and inspect GeoIP lookup configuration.

xrat geoip <command> [flags]

Subcommands

CommandDescription
downloadDownload one or more GeoLite2 MMDB editions
updateRefresh all supported GeoLite2 MMDB editions
pathPrint the resolved MMDB directory
statusShow MMDB presence and size for each supported edition
lookupLook up a single IP through the configured GeoIP backend
backendPrint the active GeoIP backend configuration

download

Download one or more GeoLite2 MMDB editions.

xrat geoip download [flags]
FlagDescription
--edition <name>Edition to download. Repeatable: GeoLite2-Country, GeoLite2-City, GeoLite2-ASN or country, city, asn
--allDownload all supported editions
--output <dir>Override the MMDB target directory for this command
--forceRe-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
--quietSuppress 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]
FlagDescription
--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
--quietSuppress progress bar output

Example

xrat geoip update

path

Print the resolved MMDB directory.

xrat geoip path [flags]
FlagDescription
--output <dir>Override the MMDB target directory for this command

Resolution order:

  1. --output flag, if provided
  2. [mmdb].dir from config (resolved relative to XRAT_PATH or config file location)
  3. 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]
FlagDescription
--output <dir>Override the MMDB target directory for this command
--strictExit 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]
ArgumentDescription
ipIP address to look up
FlagDescription
--backend <name>Override backend: mmdb, ipwhois, ip-api
--no-cacheBypass the configured in-memory cache for this invocation
--jsonPrint 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]
FlagDescription
--backend <name>Override backend: mmdb, ipwhois, ip-api
--no-cacheDescribe 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.