Software /
code /
prosody-modules
Changeset
2345:2df32ac11b31
mod_onions: Reduce line count for redirect check
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 04 Nov 2016 22:35:09 +0100 |
parents | 2344:c928b7ac75b7 |
children | 2346:dd1f0173f538 |
files | mod_onions/mod_onions.lua |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_onions/mod_onions.lua Fri Nov 04 22:33:31 2016 +0100 +++ b/mod_onions/mod_onions.lua Fri Nov 04 22:35:09 2016 +0100 @@ -65,14 +65,11 @@ end -- this means the server tells us to connect on an IPv4 address - local ip1 = byte(data, 5); - local ip2 = byte(data, 6); - local ip3 = byte(data, 7); - local ip4 = byte(data, 8); + local ip = string.format("%d.%d.%d.%d", byte(data, 5,8)); local port = band(byte(data, 9), lshift(byte(data, 10), 8)); - module:log("debug", "Should connect to: "..ip1.."."..ip2.."."..ip3.."."..ip4..":"..port); + module:log("debug", "Should connect to: %s:%d", ip, port); - if not (ip1 == 0 and ip2 == 0 and ip3 == 0 and ip4 == 0 and port == 0) then + if not (ip == "0.0.0.0" and port == 0) then module:log("debug", "The SOCKS5 proxy tells us to connect to a different IP, don't know how. :("); session:close(false); return;