Andrey Meshkov 150f2d733f Sync v2.5.1
2024-01-04 19:22:32 +03:00

22 lines
759 B
Go

// Package geoip contains implementations of the GeoIP database for AdGuard DNS.
package geoip
import (
"net/netip"
"github.com/AdguardTeam/golibs/netutil"
)
// Interface is the interface for the GeoIP database that stores the geographic
// data about an IP address.
type Interface interface {
// SubnetByLocation returns the default subnet for location, if there is
// one. If there isn't, n is an unspecified subnet. fam must be either
// [netutil.AddrFamilyIPv4] or [netutil.AddrFamilyIPv6].
SubnetByLocation(l *Location, fam netutil.AddrFamily) (n netip.Prefix, err error)
// Data returns the GeoIP data for ip. It may use host to get cached GeoIP
// data if ip is netip.Addr{}.
Data(host string, ip netip.Addr) (l *Location, err error)
}