geoip

package
v0.0.0-...-a23bd61 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CITY    = "GeoLite2-City"
	COUNTRY = "Geolite2-Country"
)

Variables

View Source
var DbLocations = []string{
	"/etc/evebox/GeoLite2-City.mmdb.gz",
	"/etc/evebox/GeoLite2-City.mmdb",
	"/usr/local/share/GeoIP/GeoLite2-City.mmdb",
	"/usr/share/GeoIP/GeoLite2-City.mmdb",
}

Functions

func FindDbPath

func FindDbPath() string

func OpenDb

func OpenDb(path string) (*geoip2.Reader, error)

Types

type GeoIp

type GeoIp struct {
	Ip            string     `json:"ip,omitempty"`
	Ip6           string     `json:"ip6,omitempty"`
	ContinentCode string     `json:"continent_code,omitempty"`
	CountryCode2  string     `json:"country_code2,omitempty"`
	CountryName   string     `json:"country_name,omitempty"`
	RegionName    string     `json:"region_name,omitempty"`
	RegionCode    string     `json:"region_code,omitempty"`
	CityName      string     `json:"city_name,omitempty"`
	Latitude      float64    `json:"latitude,omitempty"`
	Longitude     float64    `json:"longitude,omitempty"`
	Coordinates   [2]float64 `json:"coordinates,omitempty"`
}

type GeoIpDb

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

func NewGeoIpDb

func NewGeoIpDb(path string) (*GeoIpDb, error)

func (*GeoIpDb) BuildDate

func (g *GeoIpDb) BuildDate() time.Time

func (*GeoIpDb) LookupString

func (g *GeoIpDb) LookupString(addr string) (*GeoIp, error)

func (*GeoIpDb) Type

func (g *GeoIpDb) Type() string

type GeoIpService

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

func NewGeoIpService

func NewGeoIpService() *GeoIpService

func (*GeoIpService) LookupString

func (s *GeoIpService) LookupString(addr string) (*GeoIp, error)

Jump to

Keyboard shortcuts

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