Skip to main content

Module external_ip

Module external_ip 

Source
Expand description

External IP address and various information about it

§Configuration

KeyValuesDefault
formatA string to customise the output of this block. See below for available placeholders." $ip $country_flag "
intervalInterval in seconds for automatic updates300
autolocate_intervalHow long in seconds to reuse the last result from the geolocation service instead of contacting it again. Kept small by default so that network changes are picked up promptly.1
with_network_managerIf ‘true’, listen for NetworkManager events and update the IP immediately if there was a changetrue
use_ipv4If ‘true’, use IPv4 for obtaining all infofalse
KeyValueTypeUnit
ipThe external IP address, as seen from a remote serverText-
versionIPv4 or IPv6Text-
cityCity name, such as “San Francisco”Text-
regionRegion name, such as “California”Text-
region_codeRegion code, such as “CA” for CaliforniaText-
countryCountry code (2 letter, ISO 3166-1 alpha-2)Text-
country_nameShort country nameText-
country_codeCountry code (2 letter, ISO 3166-1 alpha-2)Text-
country_code_iso3Country code (3 letter, ISO 3166-1 alpha-3)Text-
country_capitalCapital of the countryText-
country_tldCountry specific TLD (top-level domain)Text-
continent_codeContinent codeText-
in_euRegion code, such as “CA”Flag-
postalZIP / Postal codeText-
latitudeLatitudeNumber- (TODO: make degrees?)
longitudeLongitudeNumber- (TODO: make degrees?)
timezoneCityText-
utc_offsetUTC offset (with daylight saving time) as +HHMM or -HHMM (HH is hours, MM is minutes)Text-
country_calling_codeCountry calling code (dial in code, comma separated)Text-
currencyCurrency code (ISO 4217)Text-
currency_nameCurrency nameText-
languagesLanguages spoken (comma separated 2 or 3 letter ISO 639 code with optional hyphen separated country suffix)Text-
country_areaArea of the country (in sq km)Number-
country_populationPopulation of the countryNumber-
timezoneTime zoneText-
orgOrganizationText-
asnAutonomous system (AS)Text-
country_flagFlag of the countryText (glyph)-

§Example

[[block]]
block = "external_ip"
format = " $ip $country_code "

§Notes

All the information comes from https://ipapi.co/json/ Check their documentation here: https://ipapi.co/api/#complete-location5

The IP is queried, 1) When i3status-rs starts, 2) When a signal is received on D-Bus about a network configuration change, 3) Every 5 minutes. This periodic refresh exists to catch IP updates that don’t trigger a notification, for example due to a IP refresh at the router.

If the service reports rate limiting, the block keeps showing the last known IP and waits for the geolocator’s rate_limit_interval (10 minutes by default) before asking again.

Flags: They are not icons but unicode glyphs. You will need a font that includes them. Tested with: https://www.babelstone.co.uk/Fonts/Flags.html

Structs§

Config

Functions§

run