]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Add `rip` keyword to ratelimit module 1389/head
authorAndrew Lewis <nerf@judo.za.org>
Wed, 1 Feb 2017 16:28:30 +0000 (18:28 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Wed, 1 Feb 2017 16:28:30 +0000 (18:28 +0200)
src/plugins/lua/ratelimit.lua

index c532e43795ac0fe9786db515d3bfced9a382c649..d1503f3c3cdc206add35380b537e71601e4694bf 100644 (file)
@@ -113,6 +113,13 @@ local keywords = {
       return nil
     end,
   },
+  ['rip'] = {
+    ['get_value'] = function(task)
+      local ip = task:get_ip()
+      if ip and ip:is_valid() and not ip:is_local() then return ip end
+      return nil
+    end,
+  },
   ['from'] = {
     ['get_value'] = function(task)
       local from = task:get_from(0)