Improve endpoint/rule lists and filtering of DNS requests

This commit is contained in:
Daniel
2021-08-19 23:29:29 +02:00
parent 1b4a7568f2
commit f34dccb8f3
8 changed files with 52 additions and 45 deletions

View File

@@ -21,9 +21,17 @@ type EndpointCountry struct {
// Matches checks whether the given entity matches this endpoint definition.
func (ep *EndpointCountry) Matches(ctx context.Context, entity *intel.Entity) (EPResult, Reason) {
if entity.IP == nil {
return NoMatch, nil
}
if !entity.IPScope.IsGlobal() {
return NoMatch, nil
}
country, ok := entity.GetCountry(ctx)
if !ok {
return Undeterminable, nil
return MatchError, ep.makeReason(ep, country, "country data not available to match")
}
if country == ep.Country {