Awesome Go

publicip

CategoryNetworking
SubcategoryNetworking
Stars0

Package publicip returns your public facing IPv4 address (internet egress)

About publicip

#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 [email protected]

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)
  }

}

Frequently Asked Questions

What is publicip?

publicip is a Networking library for the Go programming language. Package publicip returns your public facing IPv4 address (internet egress)

How do I install publicip?

Install publicip with the Go module system using `go get polera/publicip`. Check the repository for the current installation instructions.

What category does publicip belong to?

publicip is listed under Networking, specifically Networking.

← Back to Networking