wafris 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/lua/dist/wafris_core.lua +3 -3
- data/lib/wafris/configuration.rb +12 -4
- data/lib/wafris/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8a2722b928a9589d9a25292b4116200e428fabfbbc7fa7d15e2eaada1a42927a
|
4
|
+
data.tar.gz: c3b941f3ed47136b92731e62df8dbb9d47c29d0817bf85e5b974bcd7b01c9ca8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e52e73b5d385e3a81ee4f5845f50dc00cd52683b595db3e5cb4f47ca7e573d49343525b8c2d6de423f9f189752b82f47acb71240d298b509f1da9b72023313e
|
7
|
+
data.tar.gz: b8cb1ccb52d9edc06756f78b277ff4ca2c2c39c94bea68e1e913b74dd620cf8033342759b232cfa086e6cf55f683729258cbb44488eca08f4d821ee751ab1929
|
@@ -67,7 +67,7 @@ local function add_to_graph_timebucket(timebucket, request_id)
|
|
67
67
|
local key = wafris_prefix .. "gr-ct:"
|
68
68
|
redis.call("PFADD", key .. timebucket, request_id)
|
69
69
|
-- Expire the key after 25 hours if it has no expiry
|
70
|
-
redis.call("EXPIRE", key, 90000
|
70
|
+
redis.call("EXPIRE", key, 90000)
|
71
71
|
end
|
72
72
|
|
73
73
|
-- For: Leaderboard of IPs with Request count as score
|
@@ -75,7 +75,7 @@ local function increment_timebucket_for(type, timebucket, property)
|
|
75
75
|
local key = wafris_prefix .. type .. "lb:" .. timebucket
|
76
76
|
redis.call("ZINCRBY", key, 1, property)
|
77
77
|
-- Expire the key after 25 hours if it has no expiry
|
78
|
-
redis.call("EXPIRE", key, 90000
|
78
|
+
redis.call("EXPIRE", key, 90000)
|
79
79
|
end
|
80
80
|
|
81
81
|
local function increment_partial_hourly_request_counters(unix_time_milliseconds)
|
@@ -85,7 +85,7 @@ local function increment_partial_hourly_request_counters(unix_time_milliseconds)
|
|
85
85
|
local key = wafris_prefix .. "hr-ct:" .. timebucket
|
86
86
|
redis.call("INCR", key)
|
87
87
|
-- Expire the key after 61 minutes if it has no expiry
|
88
|
-
redis.call("EXPIRE", key, 3660
|
88
|
+
redis.call("EXPIRE", key, 3660)
|
89
89
|
end
|
90
90
|
end
|
91
91
|
|
data/lib/wafris/configuration.rb
CHANGED
@@ -6,14 +6,22 @@ module Wafris
|
|
6
6
|
attr_accessor :redis_pool_size
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@redis =
|
10
|
-
url: ENV['REDIS_URL'],
|
11
|
-
ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
|
12
|
-
)
|
9
|
+
@redis = set_redis
|
13
10
|
@redis_pool_size = 20
|
14
11
|
set_version
|
15
12
|
end
|
16
13
|
|
14
|
+
def set_redis
|
15
|
+
if ENV['REDIS_URL']
|
16
|
+
Redis.new(
|
17
|
+
url: ENV['REDIS_URL'],
|
18
|
+
ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE }
|
19
|
+
)
|
20
|
+
else
|
21
|
+
Redis.new
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
17
25
|
def connection_pool
|
18
26
|
@connection_pool ||=
|
19
27
|
ConnectionPool.new(size: redis_pool_size) { redis }
|
data/lib/wafris/version.rb
CHANGED