GeoIP is a FreeGeoIP API abstraction library written in Go like the original package. This package utilizes the freely available RESTful API found on their website. API Documentation on go.pkgdoc.org.
go get github.com/polds/GeoIP
package main
import (
"fmt"
"github.com/polds/GeoIP"
)
func main() {
info, err := GeoIP.Fetch("127.0.0.1")
if err != nil {
panic(err) // Could be rate limiting or not found
}
fmt.Println(info.City)
fmt.Println(info.CountryCode)
}
GoConvey is used in this library for testing. Testing can be done two different ways:
go test -v
or likewise you can run the GoConvey web UI to run the tests
goconvey .
- As of February 19, 2014 this library is considered complete. No additional features will be added. Should a Go version change require any changes to the library it will be updated. Please be aware this is not an abandoned project but is used on a daily basis.
- This library has been run through golint.
Any feature requets, comments, concerns are welcome: @Peter_Olds