Documentation ¶
Overview ¶
Package geodata includes utilities to decode and parse the geoip & geosite dat files.
It relies on the proto structure of GeoIP, GeoIPList, GeoSite and GeoSiteList in github.com/v2fly/v2ray-core/v4/app/router/config.proto to comply with following rules:
- GeoIPList and GeoSiteList cannot be changed
- The country_code in GeoIP and GeoSite must be a length-delimited `string`(wired type) and has field_number set to 1
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrFailedToReadBytes = errors.New("failed to read bytes") ErrFailedToReadExpectedLenBytes = errors.New("failed to read expected length of bytes") ErrInvalidGeodataFile = errors.New("invalid geodata file") ErrInvalidGeodataVarintLength = errors.New("invalid geodata varint length") ErrCodeNotFound = errors.New("code not found") )
Functions ¶
Types ¶
type GeodataLoader ¶
type GeodataLoader interface { LoadIP(filename, country string) ([]*v2router.CIDR, error) LoadSite(filename, list string) ([]*v2router.Domain, error) LoadGeoIP(country string) ([]*v2router.CIDR, error) LoadGeoSite(list string) ([]*v2router.Domain, error) }
func NewGeodataLoader ¶
func NewGeodataLoader() GeodataLoader
Click to show internal directories.
Click to hide internal directories.