database

package
v0.0.159 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ASN

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

func NewASN

func NewASN(config *Config, log logrus.FieldLogger) *ASN

func (*ASN) Lookup

func (c *ASN) Lookup(ip net.IP) (*LookupASN, error)

func (*ASN) Start

func (c *ASN) Start() error

func (*ASN) Stop

func (c *ASN) Stop() error

type City

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

func NewCity

func NewCity(config *Config, log logrus.FieldLogger) *City

func (*City) Lookup

func (c *City) Lookup(ip net.IP) (*LookupCity, error)

func (*City) Start

func (c *City) Start() error

func (*City) Stop

func (c *City) Stop() error

type Config

type Config struct {
	City string `yaml:"city"`
	ASN  string `yaml:"asn"`
}

func (*Config) Validate

func (c *Config) Validate() error

type LookupASN

type LookupASN struct {
	AutonomousSystemNumber       uint32 `maxminddb:"autonomous_system_number"`
	AutonomousSystemOrganization string `maxminddb:"autonomous_system_organization"`
}

type LookupCity

type LookupCity struct {
	Country struct {
		ISOCode string `maxminddb:"iso_code"`
		Names   struct {
			EN string `maxminddb:"en"`
		} `maxminddb:"names"`
	} `maxminddb:"country"`
	Continent struct {
		Code string `maxminddb:"code"`
	} `maxminddb:"continent"`
	City struct {
		Names struct {
			EN string `maxminddb:"en"`
		} `maxminddb:"names"`
	} `maxminddb:"city"`
	Location struct {
		Latitude  float64 `maxminddb:"latitude"`
		Longitude float64 `maxminddb:"longitude"`
	} `maxminddb:"location"`
}

Jump to

Keyboard shortcuts

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