Documentation
¶
Overview ¶
Package ipdb provides local IP database lookups.
Index ¶
Constants ¶
View Source
const ( DriverIP2Region = "ip2region" DriverMaxMind = "maxmind" DriverMaxMindCity = "maxmind-city" DriverMaxMindASN = "maxmind-asn" )
View Source
const ( IP2RegionModeFile = "file" IP2RegionModeVectorIndex = "vector_index" IP2RegionModeMemory = "memory" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Driver string
// Path is used by ip2region, maxmind-city and maxmind-asn.
Path string
// CityPath and ASNPath are used by DriverMaxMind to merge City and ASN records.
CityPath string
ASNPath string
// Language selects localized names from MaxMind databases.
Language string
// Mode controls ip2region loading strategy: file, vector_index or memory.
Mode string
// Hooks observe lookup results. Hook failures must be handled by the hook itself.
Hooks []Hook
}
type Hook ¶
type Hook interface {
AfterLookup(ctx context.Context, event LookupEvent)
}
type HookFunc ¶
type HookFunc func(ctx context.Context, event LookupEvent)
func (HookFunc) AfterLookup ¶
func (f HookFunc) AfterLookup(ctx context.Context, event LookupEvent)
type LookupEvent ¶
type Record ¶
type Record struct {
IP string `json:"ip,omitempty"`
Version int `json:"version,omitempty"`
Source string `json:"source,omitempty"`
Continent string `json:"continent,omitempty"`
ContinentCode string `json:"continent_code,omitempty"`
Country string `json:"country,omitempty"`
CountryCode string `json:"country_code,omitempty"`
Region string `json:"region,omitempty"`
RegionCode string `json:"region_code,omitempty"`
Province string `json:"province,omitempty"`
City string `json:"city,omitempty"`
District string `json:"district,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
TimeZone string `json:"time_zone,omitempty"`
ISP string `json:"isp,omitempty"`
ASN string `json:"asn,omitempty"`
ASNumber uint `json:"as_number,omitempty"`
ASOrganization string `json:"as_organization,omitempty"`
Latitude *float64 `json:"latitude,omitempty"`
Longitude *float64 `json:"longitude,omitempty"`
Network string `json:"network,omitempty"`
RegisteredCountry string `json:"registered_country,omitempty"`
RegisteredCountryCode string `json:"registered_country_code,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.