https://github.com/knbr13/myip
a small tool to get your public and some useful info in a single command
https://github.com/knbr13/myip
cli go ip tool
Last synced: about 1 year ago
JSON representation
a small tool to get your public and some useful info in a single command
- Host: GitHub
- URL: https://github.com/knbr13/myip
- Owner: knbr13
- Created: 2023-06-16T00:44:23.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-30T06:20:15.000Z (over 2 years ago)
- Last Synced: 2025-02-09T15:44:12.359Z (over 1 year ago)
- Topics: cli, go, ip, tool
- Language: Go
- Homepage:
- Size: 174 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## MyIP
MyIP is a small Go application that retrieves information about your public and private IP addresses. It provides the data in either plain text or JSON format.

### Usage
#### Flags
- `-json`: Display results in JSON format.
- `-rich`: Display results in rich JSON format with additional information.
### Running the Tool
1. Clone the repository.
2. Navigate to the tool's directory.
3. Build the tool:
```
go build myip
```
4. Run the tool:
```
./myip
```
### Example Usage
1. Display public and private IP addresses in plain text:
```
./myip
```
2. Display results in JSON format:
```
./myip -json
```
3. Display rich JSON format with additional information:
```
./myip -json -rich
```
### Output Formats
#### Plain Text
Public IP :
Private IP :
(Additional information for rich format:
Country :
City :
Region :
Location :
HostName :
Organization :
)
#### JSON Format
- Plain JSON:
```
{ "publicIP": "", "privateIP": "" }
```
- Rich JSON:
```
{
"public IP": "",
"private IP": "",
"info": {
"ip": "",
"country": "",
"city": "",
"region": "",
"loc": "",
"org": "",
"hostname": ""
}
}
```