geoip

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2022 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CHECKSUM_URL string = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&suffix=tar.gz.sha256&license_key="
View Source
const DATABASE_URL string = "https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&suffix=tar.gz&license_key="

Variables

This section is empty.

Functions

This section is empty.

Types

type GeoIPHandler

type GeoIPHandler struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

GeoIPHandler will keep itself up-to-date with the latest GeoIP database by updating once every 24 hours Provides methods to lookup IP addresses and return the associated latitude and longitude The structure should be created with it's maxmind license key

func NewGeoIPHandler

func NewGeoIPHandler(licenseKey string) (*GeoIPHandler, error)

NewGeoIPHandler creates a new GeoIPHandler with the given license key

func (*GeoIPHandler) Close

func (g *GeoIPHandler) Close()

func (*GeoIPHandler) Lookup

func (g *GeoIPHandler) Lookup(ip net.IP) (*geoip2.CityResult, error)

Jump to

Keyboard shortcuts

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