aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-09-09 14:45:23 +0100
committerEmmanuel Gil Peyrot <linkmauve@linkmauve.fr>2017-09-09 14:45:23 +0100
commitc70ac331d23db3583e0db349056799eb9a25b6f7 (patch)
treefac91aa68954e125deaddb88741588028e568d1f /plugins
parentec22a5c10db7898508a3c9516088921d1782bfb2 (diff)
downloadprosody-c70ac331d23db3583e0db349056799eb9a25b6f7.tar.gz
prosody-c70ac331d23db3583e0db349056799eb9a25b6f7.zip
mod_s2s: Add a counter for IPv6.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_s2s/mod_s2s.lua8
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_s2s/mod_s2s.lua b/plugins/mod_s2s/mod_s2s.lua
index e85ec6bd..f1f88127 100644
--- a/plugins/mod_s2s/mod_s2s.lua
+++ b/plugins/mod_s2s/mod_s2s.lua
@@ -39,6 +39,7 @@ local secure_domains, insecure_domains =
local require_encryption = module:get_option_boolean("s2s_require_encryption", false);
local measure_connections = module:measure("connections", "amount");
+local measure_ipv6 = module:measure("ipv6", "amount");
local sessions = module:shared("sessions");
@@ -48,10 +49,15 @@ local log = module._log;
module:hook("stats-update", function ()
local count = 0;
- for _ in pairs(sessions) do
+ local ipv6 = 0;
+ for _, session in pairs(sessions) do
count = count + 1;
+ if session.ip and session.ip:match(":") then
+ ipv6 = ipv6 + 1;
+ end
end
measure_connections(count);
+ measure_ipv6(ipv6);
end);
--- Handle stanzas to remote domains