package
module
Version:
v0.0.0-...-0783622
Opens a new window with list of versions in this module.
Published: Sep 29, 2024
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 1
Opens a new window with list of known importers.
README
¶
Intro
Package ip2country
provides IPv4 and IPv6 address to country lookups in Go.
Install
go get github.com/amitybell/ip2country
Usage
package main
import (
"github.com/amitybell/ip2country"
"fmt"
)
func main() {
fmt.Println(ip2country.LookupString("1.2.3.4"))
}
License
The package itself is distributed under the MIT license.
The database is compiled from the MaxMind geolite2-city CSVs distributed by https://github.com/sapics/ip-location-db/tree/main/geolite2-country and is therefore subject to the MaxMind EULA https://www.maxmind.com/en/geolite2/eula
Documentation
¶
Lookup returns the country (code) in which ip is located, or an error if not found.
LookupString is a wrapper Lookup(net.ParseIP(ip))
Source Files
¶
Click to show internal directories.
Click to hide internal directories.