-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not fail immediately on invalid row
ProcessGeofeed func doesn't fail on the first invalid row, but returns ErrInvalidGeofeed if invalid row was detected during geofeed check. If there is need to set a failure threshold, error should be checked for being ErrInvalidGeofeed and then use CheckResult for analysis.
- Loading branch information
Showing
14 changed files
with
329 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package verify | ||
|
||
import "errors" | ||
|
||
// ErrInvalidGeofeed represents error that is returned in case of incomplete compliance | ||
// with RFC 8805 standards and the mode in which the program is run. | ||
var ErrInvalidGeofeed = errors.New("geofeed does not comply with the RFC 8805 standards") | ||
|
||
// RowInvalidity represents type of row invalidity. | ||
type RowInvalidity int | ||
|
||
// Invalidity types. | ||
const ( | ||
FewerFieldsThanExpected RowInvalidity = iota | ||
EmptyNetwork | ||
UnableToParseNetwork | ||
UnableToFindCityRecord | ||
UnableToFindISPRecord | ||
InvalidRegionCode | ||
) | ||
|
||
// String implements the Stringer interface. | ||
func (ri RowInvalidity) String() string { | ||
switch ri { | ||
case FewerFieldsThanExpected: | ||
return "FewerFieldsThanExpected" | ||
case EmptyNetwork: | ||
return "EmptyNetwork" | ||
case UnableToParseNetwork: | ||
return "UnableToParseNetwork" | ||
case UnableToFindCityRecord: | ||
return "UnableToFindCityRecord" | ||
case UnableToFindISPRecord: | ||
return "UnableToFindISPRecord" | ||
case InvalidRegionCode: | ||
return "InvalidRegionCode" | ||
default: | ||
return "UnknownInvalidityType" | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
2a02:ecc0::/29 ,US,US-NJ, Parsippany ,# valid row with difference from GeoIP2-City_test.mmdb | ||
,,,, |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
2a02:/29,,,, | ||
2a02:ecc0::/29 ,US,US-NJ, Parsippany ,# valid row with difference from GeoIP2-City_test.mmdb |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.