Country code of an IP

Syntax

COUNTRYCODE …ip-expr…

COUNTRY_CODE …ip-expr…

Typing

IPv4 -> STRING?

IPv6 -> STRING?

Ip -> STRING?

Description

Return the country-code (as a string) of an IP (v4 or v6).

Ramen relies on an embedded, constant database of IP geo-locations that's designed for speed. It therefore makes no external request. As a downside, the information can be outdated or missing (in which case NULL is returned).

Given the embedded database might change from one version of Ramen to the next, this function is not deterministic across upgrades.

This function should be only used as a hint.

Examples

expression evaluates to
COUNTRYCODE 5.182.236.0 "AT"
COUNTRYCODE 2a00:1450:400f:804::2004 "IE"

See Also

Returns the version of an IP