Mercurial > prosody-modules
diff mod_onions/mod_onions.lua @ 1061:f4031e7ccec1
mod_onions: The SOCKS5 port is now a string, as it should be. Added a boolean option onions_tor_all to pass all s2s traffic through Tor.
author | Thijs Alkemade <me@thijsalkema.de> |
---|---|
date | Mon, 10 Jun 2013 21:39:48 +0200 |
parents | 25b83ed7838a |
children | 8f59b45fe6a7 |
line wrap: on
line diff
--- a/mod_onions/mod_onions.lua Mon Jun 10 20:59:39 2013 +0200 +++ b/mod_onions/mod_onions.lua Mon Jun 10 21:39:48 2013 +0200 @@ -8,14 +8,15 @@ local c = string.char; local proxy_ip = module:get_option("onions_socks5_host") or "127.0.0.1"; -local proxy_port = module:get_option("onions_socks5_port") or "9050"; +local proxy_port = module:get_option("onions_socks5_port") or 9050; local forbid_else = module:get_option("onions_only") or false; +local torify_all = module:get_option("onions_tor_all") or false; local sessions = module:shared("sessions"); -- The socks5listener handles connection while still connecting to the proxy, -- then it hands them over to the normal listener (in mod_s2s) -local socks5listener = { default_port = tonumber(proxy_port), default_mode = "*a", default_interface = "*" }; +local socks5listener = { default_port = proxy_port, default_mode = "*a", default_interface = "*" }; local function socks5_connect_sent(conn, data) @@ -215,7 +216,7 @@ if forbid_else then module:log("debug", event.to_host .. " is not an onion. Blocking it."); return false; - else + elseif not torify_all then return; end end