# HG changeset patch # User Kim Alvefur # Date 1478295309 -3600 # Node ID 2df32ac11b31043498feb3d3c10d4741de7224f5 # Parent c928b7ac75b73769df19a8b8ea85a79f782111e3 mod_onions: Reduce line count for redirect check diff -r c928b7ac75b7 -r 2df32ac11b31 mod_onions/mod_onions.lua --- 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;