geoip2

package
v3.0.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2019 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindDB

func FindDB() string

FindDB returns a guess at a directory path for GeoIP data files

Types

type GeoIP2

type GeoIP2 struct {
	// contains filtered or unexported fields
}

GeoIP2 contains the geoip implementation of the GeoDNS geo targeting interface

func New

func New(dir string) (*GeoIP2, error)

New returns a new GeoIP2 provider

func (*GeoIP2) GetASN

func (g *GeoIP2) GetASN(ip net.IP) (string, int, error)

GetASN returns the ASN for the IP (as a "as123" string) and the netmask

func (*GeoIP2) GetCountry

func (g *GeoIP2) GetCountry(ip net.IP) (country, continent string, netmask int)

GetCountry returns the country, continent and netmask for the given IP

func (*GeoIP2) GetLocation

func (g *GeoIP2) GetLocation(ip net.IP) (l *geo.Location, err error)

GetLocation returns a geo.Location object for the given IP

func (*GeoIP2) HasASN

func (g *GeoIP2) HasASN() (bool, error)

HasASN returns if we can do ASN lookups

func (*GeoIP2) HasCountry

func (g *GeoIP2) HasCountry() (bool, error)

HasCountry checks if the GeoIP country database is available

func (*GeoIP2) HasLocation

func (g *GeoIP2) HasLocation() (bool, error)

HasLocation returns if the city database is available to return lat/lon information for an IP

Jump to

Keyboard shortcuts

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