Registry / networking / oschwald-geoip2-golang

oschwald-geoip2-golang

JSON →
library1.13.0gogounverified

An easy-to-use API for reading MaxMind GeoIP2 and GeoLite2 databases in Go.

go get github.com/oschwald/geoip2-golang
INSTALL
IMPORT
SIG · OSCHWALD-GEOIP2-GO
O
oschwald-geoip2-golang
networkinggov1.13.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

geoip2
github.com/oschwald/geoip2-golang

Open a GeoIP2 database and look up a city by IP address.

package main import ( "fmt" "github.com/oschwald/geoip2-golang" ) func main() { db, err := geoip2.Open("GeoIP2-City.mmdb") if err != nil { panic(err) } defer db.Close() record, err := db.City("8.8.8.8") if err != nil { panic(err) } fmt.Printf("City: %s\n", record.City.Names["en"]) }
Debug
Known issues

No known issues recorded.

Upgrade
Version history
1.13.0latest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
oschwald-geoip2-golang — go get oschwald-geoip2-golang · libregistry