geoip

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2019 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrimitiveNetworkProximity

func PrimitiveNetworkProximity(from net.IP, to net.IP, ipVersion uint8) int

func ReloadDatabases

func ReloadDatabases() error

Types

type Location

type Location struct {
	Continent struct {
		Code string `maxminddb:"code"`
	} `maxminddb:"continent"`
	Country struct {
		ISOCode string `maxminddb:"iso_code"`
	} `maxminddb:"country"`
	Coordinates struct {
		AccuracyRadius uint16  `maxminddb:"accuracy_radius"`
		Latitude       float64 `maxminddb:"latitude"`
		Longitude      float64 `maxminddb:"longitude"`
	} `maxminddb:"location"`
	AutonomousSystemNumber       uint   `maxminddb:"autonomous_system_number"`
	AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"`
}

Location holds information regarding the geographical and network location of an IP address

func GetLocation

func GetLocation(ip net.IP) (record *Location, err error)

GetLocation returns Location data of an IP address

func (*Location) EstimateNetworkProximity

func (l *Location) EstimateNetworkProximity(to *Location) (proximity int)

EstimateNetworkProximity aims to calculate a distance value between 0 and 100.

Jump to

Keyboard shortcuts

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