Skip to content

Go pkg for returning your public facing IP address.

License

Notifications You must be signed in to change notification settings

standardgalactic/publicip

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#publicip

This package returns the public facing IP address of the calling client (a la https://icanhazip.com, but from Go!)

GoDoc License Go Report Card codecov

Author

James Polera james@uncryptic.com

Dependencies

publicip uses Glide for dependency management. After cloning this package, run:

glide up

Credits

This package was inspired by both:

public-ip (nodejs)

OpenDNS::MyIP (Perl)

Example

package main

import (
  "fmt"
  "github.com/polera/publicip"
)

func main() {

  myIpAddr, err := publicip.GetIP()
  if err != nil {
    fmt.Printf("Error getting IP address: %s\n", err)
  } else {
    fmt.Printf("Public IP address is: %s", myIpAddr)
  }

}

About

Go pkg for returning your public facing IP address.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 100.0%