models

package
v0.0.0-...-c8d6da5 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDBs

func CloseDBs()

CloseDBs unmaps from memory and frees resources to the filesystem

func Setup

func Setup(cityPath string, asnPath string)

Setup opens all Geolite2 databases

Types

type ASNRecord

type ASNRecord struct {
	AutonomousSystemNumber       uint   `maxminddb:"autonomous_system_number"`
	AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"`
}

ASNRecord is the model for ASN database

func (*ASNRecord) LookUp

func (record *ASNRecord) LookUp(ip net.IP) error

LookUp an IP and get ASN data

type GeoRecord

type GeoRecord struct {
	Country struct {
		ISOCode string            `maxminddb:"iso_code"`
		Names   map[string]string `maxminddb:"names"`
	} `maxminddb:"country"`
	City struct {
		Names map[string]string `maxminddb:"names"`
	} `maxminddb:"city"`
	Location struct {
		Latitude  float64 `maxminddb:"latitude"`
		Longitude float64 `maxminddb:"longitude"`
		TimeZone  string  `maxminddb:"time_zone"`
	} `maxminddb:"location"`
	Postal struct {
		Code string `maxminddb:"code"`
	} `maxminddb:"postal"`
}

GeoRecord is the model for City database

func (*GeoRecord) LookUp

func (record *GeoRecord) LookUp(ip net.IP) error

LookUp an IP and get city data

Jump to

Keyboard shortcuts

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