Get IP Address with Golang


Get IP address(es) with go-lang is a simple command line tool to get your IP address vpn, internal, external, etc.


ipinfo -h
A longer description that spans multiple lines and likely contains
examples and usage of using your application. For example:

Cobra is a CLI library for Go that empowers applications.
This application is a tool to generate the needed files
to quickly create a Cobra application.

  ipinfo [command]

Available Commands:
  completion  Generate the autocompletion script for the specified shell
  external    Get external ip information
  help        Help about any command
  internal    Get internal ip information
  version     Show ipinfo version information
  vpn         Get vpn ip information

  -h, --help     help for ipinfo
  -t, --toggle   Help message for toggle

Use "ipinfo [command] --help" for more information about a command.

External IP:

ipinfo external
External ip address: xx.xx.xx.xx

Internal IP:

ipinfo internal
VPN ip address:


ipinfo vpn
VPN ip address: xx.xx.xx.xx
  • How to install ipinfo
go install[email protected]
go get -u[email protected]
go install[email protected]

Cobra Generator

cobra-cli usage

cobra-cli init
go run main.go
cobra-cli add internal



View Github