A fast and simple command-line tool to check your public IP-address. It can also double as a network connectivity checker.
- Fast — Quires multiple different APIs at once and returns the first response while discarding the others.
- Simple — Does one thing and does it well, with a minimal number of options, in a single source file, using only the Go standard library.
- IPv4 and IPv6 — Prints both by default but can print only one with the
--ipv4/-4and--ipv6/-6flags. The default behaviour can be changed to a specific version by setting theWUT_DEFAULT_IP_VERSIONenvironment variable toipv4/4oripv6/6. To print both versions with the environment variable set use the--bothor-bflag. - Short output — Does a pretty print by default but can print only an address with no white-space using the
--shortor-sflag. This flag additionally requires the IP version be explicitly specified with the--ipv4/-4or--ipv6/-6flags or theWUT_DEFAULT_IP_VERSIONenvironment variable. - Specify interface or local IP — Use a specific interface name or local IP by passing the
--interfaceor-iflag. If an interface name is specified the first IPv4 and/or IPv6 will be chosen local IP(s). - Custom API — One or more custom HTTP API address(es) can be supplied with one or more
--apior-aflag(s). This expects that the API responds with only the IP-address in plaintext, as only white-space is trimmed from the response. It should also support both IPv4 and IPv6 for full functionality. Unencrypted HTTP is used by default unless a protocol is specified, e.g.https://. - Custom timeout — Use a custom API fetch timeout in seconds with the
--timeoutor-tflag. By default, the timeout is three seconds. - Verbose error output — Print verbose error output with the
--verboseflag. - Print version — Print the program version with the
--versionor-vflag. - Print usage — Print program usage instructions with the
--helpor-hflag.
Since wut is a standalone binary,
it can be downloaded for the applicable platform from the releases page
and run from anywhere.
To install it automatically to the command-line path, the command below can be run with elevated privileges.
Darwin (macOS) and Linux:
curl -sSL https://raw.githubusercontent.com/nixigaj/wut/master/install.sh | shDarwin (macOS) and Linux with sudo inserted:
curl -sSL https://raw.githubusercontent.com/nixigaj/wut/master/install.sh | sudo shFreeBSD:
fetch -qo - https://raw.githubusercontent.com/nixigaj/wut/master/install.sh | shFreeBSD with doas inserted:
fetch -qo - https://raw.githubusercontent.com/nixigaj/wut/master/install.sh | doas shWindows:
powershell -ExecutionPolicy Unrestricted -Command "Invoke-RestMethod -Uri https://raw.githubusercontent.com/nixigaj/wut/master/install.ps1 | Invoke-Expression"Prebuilt binaries are available for:
| OS | 386 |
amd64 |
arm |
arm64 |
|---|---|---|---|---|
| Darwin (macOS) | ✅ | ✅ | ||
| FreeBSD | ✅ | ✅ | ✅ | ✅ |
| Linux | ✅ | ✅ | ✅ | ✅ |
| Windows | ✅ | ✅ | ✅ | ✅ |
If your platform is not in the table, you can try building it from source below.
- Go 1.16 or higher
- Git
- Make (not required for Windows)
git clone https://github.com/nixigaj/wut.git
cd wutmake buildRun this command with elevated privileges:
make installOn Windows make can be replaced with .\make.bat in the commands.
By default wut uses:
- api64.ipify.org
- icanhazip.com (this is usually the first one to respond)
- ifconfig.me/ip
- ip.erix.dev:11313 (my own service in Sweden) (HTTP/2 only)
- ipecho.net/plain
Use this directive and make sure that Nginx is not behind a reverse HTTP proxy:
return 200 "$remote_addr";
If you are feeling brave, you can also try the Rust-based server that I use for ip.erix.dev:11313.
All files in this repository are licensed under the MIT License.
The icon is a reference to the Confused Nick Young / Swaggy P meme.