Skip to content

Latest commit

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

myip

A fast CLI tool that shows your public IP address along with optional geolocation details and local weather — powered by Cloudflare Radar and Open-Meteo.

Requirements

  • Go 1.23+

Build

git clone <repo>cd myip
make build

The binary is written to ./myip. Move it somewhere on your $PATH:

mv myip ~/.local/bin/

To build a specific version:

make build VERSION=1.0.0

The -w -s ldflags are applied by default (strips debug info for a smaller binary).

Add to PATH

export PATH="$HOME/.local/bin:$PATH"

Usage

myip [flags]
FlagDescription
--detailShow full IP geolocation info (city, region, country, ASN, colo, …)
--weatherShow current weather at your detected IP location
--localShow the computer's local IPv4 and IPv6 addresses (cannot be combined with --detail, --weather, --unit, or --no-cache)
--jsonOutput as pretty-printed JSON (modifier for --detail, --weather, or --local)
--unitTemperature unit for --weather: celsius or fahrenheit (auto-detected for US and a few other countries)
--no-cacheBypass the local cache — always fetch fresh data
--helpShow help and version

Examples

# Print your public IP address (default)
myip
# Full IP geolocation table
myip --detail
# Current weather at your location
myip --weather
# Both tables combined
myip --detail --weather
# IP info as JSON
myip --detail --json
# Combined JSON output
myip --detail --weather --json
# Skip cache, fetch fresh
myip --no-cache
# Force Fahrenheit
myip --weather --unit fahrenheit
# Force Celsius
myip --weather --unit celsius
# Show local IPv4 / IPv6 addresses
myip --local
# Local addresses as JSON
myip --local --json

Cache

IP geolocation results are cached at ~/.myip/cache for 30 minutes. Use --no-cache to bypass reading from and writing to the cache.

Make targets

TargetDescription
make buildBuild the binary (default)
make tidyTidy Go module dependencies
make lintRun go vet
make staticcheckRun staticcheck — install with go install honnef.co/go/tools/cmd/staticcheck@latest
make securityRun govulncheck — install with go install golang.org/x/vuln/cmd/govulncheck@latest
make versionPrint the current version

Data sources

  • IP infohttps://ipv4-check-perf.radar.cloudflare.com/api/info
  • Weatherhttps://api.open-meteo.com (no API key required)

About

Fetch your public IPv4 or IPv6 address from the command line

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages