geoip

package
v0.0.0-...-ba7cdbd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 10, 2014 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package geoip provides allows retrieving geographical information from an incoming request.

To use this package outside of App Engine, a GeoIP database is required. See Load for more information.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func City

func City(ctx *app.Context) string

City returns the city name for the IP address associated with the given *app.Context.

func Country

func Country(ctx *app.Context) string

Country returns the country for the IP address associated with the given *app.Context, as an ISO

func LatLong

func LatLong(ctx *app.Context) (float64, float64, bool)

LatLong returns the latitude and longitude for the IP address associated with the given *app.Context. The last return value indicates if the coordinates are known.

func Load

func Load(a *app.App, filename string) error

Load loads the given GeoIP2 database from the given filename into the given *app.App. Databases can be downloaded from free from http://dev.maxmind.com/geoip/geoip2/geolite2/.

Note that the filename might point to either a bare .mmdb file or a gzip-compressed .mmdb.gz file.

On some platforms, notably App Engine, the filename argument might be empty, because the platform already provides GeoIP functionality.

func MustLoad

func MustLoad(a *app.App, filename string)

MustLoad works like Load, but panics if there's an error.

func Region

func Region(ctx *app.Context) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL