goipinfo

command module
v0.0.0-...-503245e Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

README

goipinfo (Go IP info)

goipinfo is a command-line tool written in Go to fetch IP information from multiple providers and display it in a table format.

Features

  • Fetch your public IP information using different providers (ipinfo.io, ip-api.com, my-ip.io).
  • Fetch information for a specific IP address using ip-api.com.
  • Display fetched IP information in a nicely formatted table.

Installation

Prerequisites
  • Go (version 1.22.2 or later)
Install Dependencies

After head to the cloned repository issue the following command:

go mod tidy
Build the Project
make build

Note: It will be built under the path ./build/bin/goipinfo.

Usage

Get Your Public IP Information
./goipinfo myip --provider [ipinfo|ip-api|my-ip]
  • The default provider is ip-api.

  • Example:

    ./goipinfo myip --provider ipinfo
    
Get Information for a Specific IP Address
./goipinfo info --ip 5.161.78.107
  • Note: Only ip-api can be used as the provider for this command.

  • Example:

    ./goipinfo info --ip 5.161.78.107
    
Example Outputs
myip Command
./goipinfo myip --provider ipinfo
+----------+------------------------+
|  FIELD   |         VALUE          |
+----------+------------------------+
| IP       | 104.28.242.73          |
| City     | Düsseldorf             |
| Region   | North Rhine-Westphalia |
| Country  | Germany                |
| Location | 0.000000,0.000000      |
| Org      | Cloudflare WARP        |
| Timezone | Europe/Berlin          |
+----------+------------------------+
info Command
./goipinfo info --ip 104.28.242.73
+----------+------------------------+
|  FIELD   |         VALUE          |
+----------+------------------------+
| IP       | 104.28.242.73          |
| City     | Düsseldorf             |
| Region   | North Rhine-Westphalia |
| Country  | Germany                |
| Location | 0.000000,0.000000      |
| Org      | Cloudflare WARP        |
| Timezone | Europe/Berlin          |
+----------+------------------------+

Development

Running Tests
make test
Cleaning the Build
make clean
Formatting the Code
make fmt
Linting the Code
make lint

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.

Get in touch with me @ mohrezfadaei@gmail.com 🙏

License

This project is licensed under the MIT License. See the LICENSE file for details.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cli
ip
pkg

Jump to

Keyboard shortcuts

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