https://github.com/clarketm/myip
Command line utility for displaying public and private IP addresses
https://github.com/clarketm/myip
binary executable golang ip ip-address
Last synced: 10 months ago
JSON representation
Command line utility for displaying public and private IP addresses
- Host: GitHub
- URL: https://github.com/clarketm/myip
- Owner: clarketm
- License: apache-2.0
- Created: 2017-07-26T01:35:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-07-24T03:19:46.000Z (over 6 years ago)
- Last Synced: 2025-03-28T00:44:04.798Z (11 months ago)
- Topics: binary, executable, golang, ip, ip-address
- Language: Go
- Homepage:
- Size: 122 MB
- Stars: 13
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# [myip](https://godoc.org/github.com/clarketm/myip)
Command line utility for displaying public and private IP addresses.
[](https://github.com/clarketm/myip/releases)
[](https://circleci.com/gh/clarketm/myip)
[](https://www.codacy.com/app/clarketm/myip?utm_source=github.com&utm_medium=referral&utm_content=clarketm/myip&utm_campaign=Badge_Grade)
```shell
NAME:
myip – list IP addresses.
SYNOPSIS:
myip [ opts... ]
OPTIONS:
-h, --help # Show usage.
-a, --all # Same as -e|--ethernet, -l|--loopback, -p|--public (default).
-l, --loopback # Print (IPv4/IPv6) (l)oopback IP address.
-e, --ethernet # Print (IPv4/IPv6) (e)thernet IP address.
-p, --public # Print (IPv4/IPv6) public IP address.
-v, --version # Show version number.
EXAMPLES:
myip -a # list all IP addresses.
```
## Installation
#### Golang
```shell
$ go get -u github.com/clarketm/myip
```
#### Source (Mac/Linux)
```shell
# List of builds: https://github.com/clarketm/myip/releases/
$ BUILD=darwin_amd64.tar.gz # Mac (64 bit)
# BUILD=linux_amd64.tar.gz # Linux (64 bit)
$ BIN_DIR=/usr/local/bin # `bin` install directory
$ mkdir -p $BIN_DIR
$ curl -L https://github.com/clarketm/myip/releases/download/v1.4.4/$BUILD | tar xz -C $BIN_DIR # install
```
#### Source (Windows)
* https://github.com/clarketm/myip/releases/download/v1.4.4/windows_amd64.zip
## Usage
#### Basic usage
```shell
$ myip
Ethernet (IPv4): 10.0.0.1
Ethernet (IPv6): fe80::22:a379:7bff:9092, fe80::aede:48ff:fe00:1122
Loopback (IPv4): 127.0.0.1
Loopback (IPv6): ::1, fe80::1
Public (IPv4): 71.217.233.188
```
#### Get public IP address
```shell
# Same as `myip -p`
$ myip --public
Public (IPv4): 71.217.233.188
```
---
You can see the full reference documentation for the **myip** package at [godoc.org](https://godoc.org/github.com/clarketm/myip), or through go's standard documentation system:
```bash
$ godoc -http=:6060
# Open browser to: "http://localhost:6060/pkg/github.com/clarketm/myip" to view godoc.
```
## Related
* [public-ip](https://github.com/clarketm/public-ip) – A simple public IP address API
## License
Apache-2.0 © [**Travis Clarke**](https://blog.travismclarke.com/)