Discover Packages
github.com/RevH/ipinfo
package
module
Version:
v0.0.0-...-a3270d9
Opens a new window with list of versions in this module.
Published: Jul 28, 2023
License: MIT
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 6
Opens a new window with list of known importers.
README
README
¶
Looking for new repo maintainer! please open an issue to condidate!
ipinfo
A wrapper for http://ipinfo.io written in Go language
package main
import (
"log"
"net"
"github.com/RevH/ipinfo"
)
func main() {
myIP, err := ipinfo.MyIP()
if err != nil {
log.Fatalln(err)
}
log.Println(myIP)
foreignIP, err := ipinfo.ForeignIP("8.8.8.8")
if err != nil {
log.Fatalln(err)
}
log.Println(foreignIP)
}
Expand ▾
Collapse ▴
Documentation
¶
Package ipinfo provides info on IP address location
using the http://ipinfo.io service.
type IPInfo struct {
IP string `json:"ip"`
Hostname string `json:"hostname"`
City string `json:"city"`
Region string `json:"region"`
Country string `json:"country"`
Loc string `json:"loc"`
Org string `json:"org"`
Postal string `json:"postal"`
}
IPInfo wraps json response
ForeignIP provides information about the given IP address (IPv4 or IPv6)
MyIP provides information about the public IP address of the client.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.