diff --git a/README.md b/README.md index 22aa9d4dcb3f9eae0143babb7f38e38dec53438d..477b7707a5bb24f33f4a1111e1d7938104d5ee22 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,32 @@ submission and querying. The query API is a simple IP lookup, returning a score. This conceivably could be turned into a DNS-based API as well. -## Third-party sources +## External sources -It would be nice to allow the scoring script to consult other IP-based -third-party sources, such as DNSBLs, or GeoIP lookups, etc. +The scoring script can consult other IP-based third-party sources, such +as DNSBLs, or GeoIP lookups, etc. + +These are configured via YAML snippets in a directory, each file +corresponding to a separate external source. + +Each source configuration should specify the following parameters: + +* *name*, the name of the source +* *type*, one of the supported source types (either *dnsbl* or *geoip* + at the moment) +* *params*, a dictionary of further type-specific configuration + parameters. + +The parameters for *dnsbl* source type are: + +* *domain*, the DNSBL domain to query +* *match*, a regexp pattern for the DNS query result. The default is + ".*", i.e. any result will be regarded as a positive match. + +The parameters for *geoip* source type are: + +* *paths*, a list of paths to MaxMind GeoIP databases. The default + list contains a single path, /var/lib/GeoIP/GeoLite2-Country.mmdb + +External sources can be used in the scoring script by calling the +*ext()* function, with the source name and IP address as parameters. diff --git a/ext/ext.go b/ext/ext.go index 6a2eb8ffba3bb37603eb40e890d2600101067942..69b29a462e75636ba7d0a9c51c0233f98cb0acee 100644 --- a/ext/ext.go +++ b/ext/ext.go @@ -29,7 +29,7 @@ func New(sourceType string, params map[string]interface{}) (ExternalSource, erro } match, ok := params["match"].(string) if !ok { - return nil, errors.New("missing parameter 'match'") + match = ".*" } return dnsbl.New(domain, match)