Skip to content

geeksteam/getExternalIP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

getExternalIP

Get external IP from myexternalip.com.

Useful to get external IP for Google Cloud Engine or AWS instances.

Using http://ipinfo.io web service.

Example usage:

package main

import (
	"fmt"

	"github.com/geeksteam/getExternalIP"
)

// GetIP getting external IP from web service
func main() {
	// Get only IP of your instance
	fmt.Println("Your external IP is:'" + getExternalIP.GetIP() + "'")
	// Get city of your instance's IP
	fmt.Println("Your IP city is:'" + getExternalIP.GetIPinfo().City + "'")
}

Structure of GetIPinfo() return:

type IPstruct struct {
	IP      string 
	City    string
	Region  string
	Country string 
	Loc     string 
	Org     string 
}

About

Get external IP for Google Cloud and AWS instances

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages