package
module
Version:
v0.2.0
Opens a new window with list of versions in this module.
Published: Nov 14, 2019
License: CC-BY-SA-4.0
Opens a new window with license information.
Imports: 3
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
Documentation
¶
Package ip2country uses github.com/oschwald/maxminddb-golang with an embedded GeoLite2 db
to map net.IPs to country ISO codes
Country returns ISO code of the country that given IP belongs to.
package main
import (
"fmt"
"github.com/cevatbarisyilmaz/ip2country"
"net"
)
func main() {
country, _ := ip2country.Country(net.IPv4(8, 8, 8, 8))
fmt.Println(country)
}
Output:
US
Source Files
¶
Click to show internal directories.
Click to hide internal directories.