whereami

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2022 License: MIT

README

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

golangci-lint codecov Go Report Card CodeQL

Contribute

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: go test -cover -race ./..., golangci-lint run and 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.

Directories

Path Synopsis
cmd
pkg
info
Package info is a simple logger that displays detailed information when the "--verbose" flag is set.
Package info is a simple logger that displays detailed information when the "--verbose" flag is set.
provider/providers/_whatismyipcom
Package whatismyipcom provides an interface to the www.whatismyip.com web service.
Package whatismyipcom provides an interface to the www.whatismyip.com web service.
provider/providers/inetcluecom
Package inetcluecom provides an interface to the inetclue.com web service.
Package inetcluecom provides an interface to the inetclue.com web service.
provider/providers/inetipinfo
Package inetipinfo provides an interface to the inet-ip.info.
Package inetipinfo provides an interface to the inet-ip.info.
provider/providers/ipifyorg
Package ipifyorg implements an interface to the ipify.org API.
Package ipifyorg implements an interface to the ipify.org API.
provider/providers/ipinfoio
Package ipinfoio provides an interface to the ipinfo.io API.
Package ipinfoio provides an interface to the ipinfo.io API.
provider/providers/toolpageorg
Package toolpageorg provides an interface to the en.toolpage.org web service.
Package toolpageorg provides an interface to the en.toolpage.org web service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL