Documentation
¶
Overview ¶
Package verify provides ProcessGeofeed so that it can be used by other programs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidGeofeed = errors.New("geofeed does not comply with the RFC 8805 standards")
ErrInvalidGeofeed represents error that is returned in case of incomplete compliance with RFC 8805 standards and the mode in which the program is run.
Functions ¶
This section is empty.
Types ¶
type CheckResult ¶
type CheckResult struct { Total int Differences int Invalid int SampleInvalidRows map[RowInvalidity]string }
CheckResult holds the total number of rows for a geofeed file, the number of rows that differ from expected mmdb values as well as information about the rows that failed validation. To create new CheckResult instance use NewCheckResult() func.
func NewCheckResult ¶
func NewCheckResult() CheckResult
NewCheckResult returns new CheckResult instance.
func ProcessGeofeed ¶
func ProcessGeofeed( geofeedFilename, mmdbFilename, ispFilename string, laxMode bool, ) (CheckResult, []string, map[uint]int, error)
ProcessGeofeed attempts to validate a given geofeedFilename. If laxMode is false (default), ISO-3166-2 region codes format is required. Otherwise region code is accepted both with or without country code.
type RowInvalidity ¶
type RowInvalidity int
RowInvalidity represents type of row invalidity.
const ( FewerFieldsThanExpected RowInvalidity = iota EmptyNetwork UnableToParseNetwork UnableToFindCityRecord UnableToFindISPRecord InvalidRegionCode )
Invalidity types.
func (RowInvalidity) String ¶
func (ri RowInvalidity) String() string
String implements the Stringer interface.