summaryrefslogtreecommitdiffstats
path: root/src/plugins/lua/ip_score.lua
diff options
context:
space:
mode:
authorAndrew Lewis <nerf@judo.za.org>2016-08-26 10:41:26 +0200
committerAndrew Lewis <nerf@judo.za.org>2016-08-26 10:41:26 +0200
commitd65ff9804408ebc54da40830a6139a0f51bf818f (patch)
tree2a4155623fc1a8db69ebd5eabb766d96266f1b14 /src/plugins/lua/ip_score.lua
parente8c4bf889840913f8015eeb7e665ec90904eb6cf (diff)
downloadrspamd-d65ff9804408ebc54da40830a6139a0f51bf818f.tar.gz
rspamd-d65ff9804408ebc54da40830a6139a0f51bf818f.zip
[Feature] Adaptive ratelimits
- Also per-IP and per-ASN ratelimits - Minor rework of some parts
Diffstat (limited to 'src/plugins/lua/ip_score.lua')
-rw-r--r--src/plugins/lua/ip_score.lua10
1 files changed, 3 insertions, 7 deletions
diff --git a/src/plugins/lua/ip_score.lua b/src/plugins/lua/ip_score.lua
index 677ed12a5..93d01f6c7 100644
--- a/src/plugins/lua/ip_score.lua
+++ b/src/plugins/lua/ip_score.lua
@@ -50,7 +50,7 @@ local options = {
metric = 'default',
min_score = nil,
max_score = nil,
- score_divisor = nil
+ score_divisor = 1,
}
local asn_re = rspamd_regexp.create_cached("[\\|\\s]")
@@ -138,11 +138,7 @@ local ip_score_set = function(task)
score_mult = 0
end
- if options['score_divisor'] then
- score = score_mult * rspamd_util.tanh (2.718281 * (score/options['score_divisor']))
- else
- score = score_mult * rspamd_util.tanh (2.718281 * score)
- end
+ score = score_mult * rspamd_util.tanh (2.718281 * (score/options['score_divisor']))
local hkey = ip_score_hash_key(asn, country, ipnet, ip)
local upstream,ret
@@ -341,6 +337,6 @@ if redis_params then
})
rspamd_config:register_symbol({
name = options['symbol'],
- callback = ip_score_check
+ callback = ip_score_check,
})
end