Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GeoFeedIndex ¶ added in v1.7.4
type GeoFeedIndex struct {
// contains filtered or unexported fields
}
GeoFeedIndex is an immutable longest-prefix-match GeoFeed snapshot.
func LoadGeoFeedIndex ¶ added in v1.7.4
func LoadGeoFeedIndex() (*GeoFeedIndex, error)
LoadGeoFeedIndex lazily loads or reloads the configured GeoFeed file. A failed reload returns the last valid snapshot and leaves it published.
func (*GeoFeedIndex) Generation ¶ added in v1.7.4
func (index *GeoFeedIndex) Generation() uint64
Generation identifies the successful publication that produced index.
func (*GeoFeedIndex) Lookup ¶ added in v1.7.4
func (index *GeoFeedIndex) Lookup(addr netip.Addr) (GeoFeedRecord, bool)
Lookup performs a longest-prefix match without file I/O.
type GeoFeedRecord ¶ added in v1.7.4
type GeoFeedRecord struct {
Prefix netip.Prefix
CIDR string
LtdCode string
ISO3166 string
City string
ASN string
IPWhois string
}
GeoFeedRecord is an immutable value stored in a GeoFeedIndex.
type GeoFeedRow ¶
type GeoFeedRow struct {
IPNet *net.IPNet
CIDR string
LtdCode string
ISO3166 string
City string
ASN string
IPWhois string
}
GeoFeedRow is the legacy GeoFeed representation kept for API compatibility.
func FindGeoFeedRow ¶
func FindGeoFeedRow(ipStr string, rows []GeoFeedRow) (GeoFeedRow, bool)
FindGeoFeedRow preserves the legacy first-match lookup contract.
func GetGeoFeed ¶
func GetGeoFeed(ip string) (GeoFeedRow, bool)
GetGeoFeed returns the longest-prefix GeoFeed match for ip.
func ReadGeoFeed ¶
func ReadGeoFeed() ([]GeoFeedRow, error)
ReadGeoFeed returns a detached legacy view of the current GeoFeed snapshot. When a reload fails, it returns the last valid snapshot together with the reload error.