diff options
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2017-09-09 14:45:23 +0100 |
---|---|---|
committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2017-09-09 14:45:23 +0100 |
commit | bf5d8303ce7de0a782c3472627992b963e5ce03c (patch) | |
tree | a1bc919c96fc1010bef713312aba61d90ae5b1e0 /plugins | |
parent | f7adf08e5acc078a4a5833e52c3cba20b3c9851b (diff) | |
download | prosody-bf5d8303ce7de0a782c3472627992b963e5ce03c.tar.gz prosody-bf5d8303ce7de0a782c3472627992b963e5ce03c.zip |
mod_c2s: Add a counter for IPv6.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_c2s.lua | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/plugins/mod_c2s.lua b/plugins/mod_c2s.lua index c1dbc885..d22c5625 100644 --- a/plugins/mod_c2s.lua +++ b/plugins/mod_c2s.lua @@ -28,6 +28,7 @@ local stream_close_timeout = module:get_option_number("c2s_close_timeout", 5); local opt_keepalives = module:get_option_boolean("c2s_tcp_keepalives", module:get_option_boolean("tcp_keepalives", true)); local measure_connections = module:measure("connections", "amount"); +local measure_ipv6 = module:measure("ipv6", "amount"); local sessions = module:shared("sessions"); local core_process_stanza = prosody.core_process_stanza; @@ -39,10 +40,15 @@ local runner_callbacks = {}; 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); --- Stream events handlers |