whereamifrom

Crates.iowhereamifrom
lib.rswhereamifrom
version0.5.0
created_at2025-02-18 18:14:55.320045+00
updated_at2025-03-03 18:37:34.926499+00
descriptionA tool to detect country of your public IP
homepagehttps://github.com/nixargh/whereamifrom
repositoryhttps://github.com/nixargh/whereamifrom
max_upload_size
id1560247
size56,199
(nixargh)

documentation

README

Where Am I From

Why

An elementary tool to detect Linux active interfaces change and get a country yours public IP belongs to.
I need this as I often use some VPN tunnel and want to see my current "location" at i3 status bar.

How it works

The code:

  • Checks number of active network connections.
  • If number changed app does HTTP request to external API returning geo location of IP address from where request comes.
  • Updates location country at /tmp/whereamifrom file.

Currently https://ipinfo.io/ is used.

Usage

Using command line arguments or environment variable you may change application behavior. For example to get more information and use it any way you like:

$ FILE=/tmp/test URL=http://ipinfo.io/ ./target/debug/whereamifrom

Creates:

{
  "ip": "77.88.99.100",
  "city": "Orgrimmar",
  "region": "Durotar",
  "country": "Kalimdor",
  "loc": "45.00,65.00",
  "org": "The Horde",
  "postal": "0000",
  "timezone": "Azeroth",
  "readme": "https://ipinfo.io/missingauth"
}
Commit count: 9

cargo fmt