Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/polera/publicip
Go pkg for returning your public facing IP address.
https://github.com/polera/publicip
Last synced: about 2 months ago
JSON representation
Go pkg for returning your public facing IP address.
- Host: GitHub
- URL: https://github.com/polera/publicip
- Owner: polera
- License: mit
- Created: 2016-12-28T19:31:07.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-29T04:30:29.000Z (almost 8 years ago)
- Last Synced: 2024-07-31T20:52:36.939Z (4 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 28
- Watchers: 5
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - publicip - Package publicip returns your public facing IPv4 address (internet egress). (Networking / Transliteration)
- zero-alloc-awesome-go - publicip - Package publicip returns your public facing IPv4 address (internet egress). (Networking / Transliteration)
- awesome-go - publicip - Go pkg for returning your public facing IP address. - ★ 16 (Networking)
- awesome-go-extra - publicip - 12-28T19:31:07Z|2016-12-29T04:30:29Z| (Networking / Uncategorized)
- awesome-go-zh - publicip
README
#publicip
This package returns the public facing IP address of the calling client (a la https://icanhazip.com, but from Go!)
[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg)](http://godoc.org/github.com/polera/publicip) [![License](http://img.shields.io/badge/license-mit-blue.svg)](https://raw.githubusercontent.com/polera/publicip/master/LICENSE) [![Go Report Card](https://goreportcard.com/badge/github.com/polera/publicip)](https://goreportcard.com/report/github.com/polera/publicip) [![codecov](https://codecov.io/gh/polera/publicip/branch/master/graph/badge.svg)](https://codecov.io/gh/polera/publicip)
Author
==
James PoleraDependencies
==
publicip uses Glide for dependency management. After cloning this package, run:
```bash
glide up
```Credits
==
This package was inspired by both:[public-ip (nodejs)](https://github.com/sindresorhus/public-ip/blob/master/index.js)
[OpenDNS::MyIP (Perl)](https://metacpan.org/pod/OpenDNS::MyIP)
Example
==
```go
package mainimport (
"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)
}}
```