Skip to content

Simple command line utility that prints the current global/public/dynamic IP address.

License

Notifications You must be signed in to change notification settings

KEINOS/whereami

Repository files navigation

WhereAmI

whereami is a simple command line utility that displays your current global/public IP address; works on macOS, Linux and Windows.

Useful for finding out the ephemeral (current external) IPv4 address.

$ whereami
123.234.123.124
$ whereami -help
Usage of whereami:
  -verbose
        prints detailed information if any. such as IPv6 and etc.
  • Note:
    • This command only displays IPv4 addresses. However, some service providers will return IPv6 addresses and more detailed information. In these cases, the --verbose option can be used to view the details of the provider's response.
    • To avoid a large number of API requests to the service providers, this application sleeps for one second after printing the obtained global/public IP address.

Install

  • Manual download and install:

    • Latest Releases Page
      • macOS (x86_64/M1), Windows (x86_64/ARM64), Linux (x86_64/ARM64/ARM v5, 6, 7)
      • Download the archive of your OS and architecture then extract it. Place the extracted binary in your PATH with executable permission.
      • Public Key of the signature: https://github.com/KEINOS.gpg
  • Install via Homebrew:

    • macOS, Linux and Windows WSL2. (x86_64/ARM64, M1)

      brew install KEINOS/apps/whereami
  • Install via go install:

    • Go v1.16 or above.

      go install github.com/KEINOS/whereami/cmd/whereami@latest
  • Run via Docker:

    • Multiarch build for x86_64 (Intel/AMD) and ARM64/M1 architectures.

      # The image is around 5.5MB in size
      docker pull keinos/whereami:latest
      docker run --rm keinos/whereami

Statuses

Unit Test (Versions) Unit Tests (Platform) golangci-lint CodeQL

codecov Go Report Card

Contribute

go1.16+ Go Reference

Opened Issues PR

  • GolangCI Lint rules: .golangci-lint.yml
  • To run tests in a container:
    • docker-compose --file ./.github/docker-compose.yml run v1_17
    • This will run the below on Go 1.17:
      • go test -cover -race ./...
      • golangci-lint run
      • golint ./...
  • Branch to PR:
    • main
    • ( It is recommended that DraftPR be done first to avoid duplication of work )

License

Acknowledgment

Service Providers Used

We would like to thank the following service providers that this command uses to discover global/public IP addresses.

This command requests these providers in random order and returns the first IP address with the same response. As soon as 3 of the same IP address are returned, the command stops and prints that IP address. If you notice that a provider is not working or not responding properly, please report an issue.