opendnsmyip: A Go package to return the public-facing IPv4 address of the client (by querying the Cisco OpenDNS servers).
James Polera 298c644ed7 Update README.md | 7 years ago | |
---|---|---|
.gitignore | 7 years ago | |
LICENSE | 7 years ago | |
README.md | 7 years ago | |
glide.lock | 7 years ago | |
glide.yaml | 7 years ago | |
publicip.go | 7 years ago | |
publicip_test.go | 7 years ago |
#publicip
This package returns the public facing IP address of the calling client (a la https://icanhazip.com, but from Go!)
James Polera james@uncryptic.com
publicip uses Glide for dependency management. After cloning this package, run:
glide up
This package was inspired by both:
package main
import (
"fmt"
"github.com/polera/publicip"
)
func main() {
myIpAddr, err := publicip.GetIP()
if err != nil {
fmt.Printf("Error getting IP address: %s", err)
} else {
fmt.Printf("Public IP address is: %s", myIpAddr)
}
}