sapics

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 5 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RouteViewsAsnDbipASNIPv4 = NewDB[ASN](sourceURL("asn", "ipv4"), 8, 12*time.Hour)
	RouteViewsAsnDbipASNIPv6 = NewDB[ASN](sourceURL("asn", "ipv6"), 8, 12*time.Hour)
	IptoasnASNIPv4           = NewDB[ASN](sourceURL("iptoasn-asn", "ipv4"), 8, 12*time.Hour)
	IptoasnASNIPv6           = NewDB[ASN](sourceURL("iptoasn-asn", "ipv6"), 8, 12*time.Hour)
	DbipASNIPv4              = NewDB[ASN](sourceURL("dbip-asn", "ipv4"), 8, 15*24*time.Hour)
	DbipASNIPv6              = NewDB[ASN](sourceURL("dbip-asn", "ipv6"), 8, 15*24*time.Hour)
	GeoLite2ASNIPv4          = NewDB[ASN](sourceURL("geolite2-asn", "ipv4"), 8, 2*24*time.Hour)
	GeoLite2ASNIPv6          = NewDB[ASN](sourceURL("geolite2-asn", "ipv6"), 8, 2*24*time.Hour)

	AsnCountryIPv4         = NewDB[Country](sourceURL("asn-country", "ipv4"), 8, 12*time.Hour)
	AsnCountryIPv6         = NewDB[Country](sourceURL("asn-country", "ipv6"), 8, 12*time.Hour)
	GeoAsnCountryIPv4      = NewDB[Country](sourceURL("geo-asn-country", "ipv4"), 8, 12*time.Hour)
	GeoAsnCountryIPv6      = NewDB[Country](sourceURL("geo-asn-country", "ipv6"), 8, 12*time.Hour)
	GeoWhoisAsnCountryIPv4 = NewDB[Country](sourceURL("geo-whois-asn-country", "ipv4"), 8, 12*time.Hour)
	GeoWhoisAsnCountryIPv6 = NewDB[Country](sourceURL("geo-whois-asn-country", "ipv6"), 8, 12*time.Hour)
	IptoasnCountryIPv4     = NewDB[Country](sourceURL("iptoasn-country", "ipv4"), 8, 12*time.Hour)
	IptoasnCountryIPv6     = NewDB[Country](sourceURL("iptoasn-country", "ipv6"), 8, 12*time.Hour)
	DbipCountryIPv4        = NewDB[Country](sourceURL("dbip-country", "ipv4"), 8, 15*24*time.Hour)
	DbipCountryIPv6        = NewDB[Country](sourceURL("dbip-country", "ipv6"), 8, 15*24*time.Hour)
	GeoLite2CountryIPv4    = NewDB[Country](sourceURL("geolite2-country", "ipv4"), 8, 2*24*time.Hour)
	GeoLite2CountryIPv6    = NewDB[Country](sourceURL("geolite2-country", "ipv6"), 8, 2*24*time.Hour)

	DbipCityIPv4     = NewDB[City](sourceURL("dbip-city", "ipv4"), 12, 15*24*time.Hour)
	DbipCityIPv6     = NewDB[City](sourceURL("dbip-city", "ipv6"), 12, 15*24*time.Hour)
	GeoLite2CityIPv4 = NewDB[City](sourceURL("geolite2-city", "ipv4"), 12, 2*24*time.Hour)
	GeoLite2CityIPv6 = NewDB[City](sourceURL("geolite2-city", "ipv6"), 12, 2*24*time.Hour)
)

Functions

func NewDB

func NewDB[T any](dbPath string, cacheLevel int, updateInterval time.Duration) *iplocation.LazyDB[T]

Types

type ASN

type ASN struct {
	// as_number is a unique number assigned to an Autonomous System (AS) by the IANA.
	// https://www.iana.org/
	// https://wikipedia.org/wiki/Autonomous_system_(Internet)
	AsNumber       string `json:"asNumber"`
	AsOrganization string `json:"asOrganization"`
}

func (*ASN) String

func (a *ASN) String() string

type City

type City struct {
	CountryCode string      `json:"countryCode"`
	State1      string      `json:"state1"`
	State2      string      `json:"state2,omitempty"`
	City        string      `json:"city"`
	Postcode    string      `json:"postcode,omitempty"`
	Latitude    json.Number `json:"latitude"`
	Longitude   json.Number `json:"longitude"`
	Timezone    string      `json:"timezone,omitempty"`
}

func (*City) String

func (c *City) String() string

type Country

type Country struct {
	// country_code is the two-letter code defined in ISO 3166-1 alpha-2.
	// You can get the country name, capital, continent, currency, languages,
	// etc. from the country_code by Countries Database in JSON, CSV, SQL format.
	// https://wikipedia.org/wiki/ISO_3166-1_alpha-2
	// https://github.com/annexare/Countries
	CountryCode string `json:"countryCode"`
}

func (*Country) String

func (c *Country) String() string

Jump to

Keyboard shortcuts

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