Mercurial > prosody-modules
comparison mod_onions/mod_onions.lua @ 1299:a7d6c6d2c7b5
mod_onions: Accepted patch that should fix problems when using libevent.
author | Thijs Alkemade <me@thijsalkema.de> |
---|---|
date | Tue, 04 Feb 2014 12:48:33 +0100 |
parents | 8f59b45fe6a7 |
children | 7dbde05b48a9 |
comparison
equal
deleted
inserted
replaced
1298:659da45a2b4b | 1299:a7d6c6d2c7b5 |
---|---|
90 t = filter("stanzas/out", t); | 90 t = filter("stanzas/out", t); |
91 end | 91 end |
92 if t then | 92 if t then |
93 t = filter("bytes/out", tostring(t)); | 93 t = filter("bytes/out", tostring(t)); |
94 if t then | 94 if t then |
95 return w(conn, tostring(t)); | 95 return conn:write(tostring(t)); |
96 end | 96 end |
97 end | 97 end |
98 end | 98 end |
99 | 99 |
100 session.open_stream = function () | 100 session.open_stream = function () |
134 end | 134 end |
135 | 135 |
136 module:log("debug", "Sending connect message."); | 136 module:log("debug", "Sending connect message."); |
137 | 137 |
138 -- version 5, connect, (reserved), type: domainname, (length, hostname), port | 138 -- version 5, connect, (reserved), type: domainname, (length, hostname), port |
139 conn:send(c(5) .. c(1) .. c(0) .. c(3) .. c(#session.socks5_to) .. session.socks5_to); | 139 conn:write(c(5) .. c(1) .. c(0) .. c(3) .. c(#session.socks5_to) .. session.socks5_to); |
140 conn:send(c(rshift(session.socks5_port, 8)) .. c(band(session.socks5_port, 0xff))); | 140 conn:write(c(rshift(session.socks5_port, 8)) .. c(band(session.socks5_port, 0xff))); |
141 | 141 |
142 session.socks5_handler = socks5_connect_sent; | 142 session.socks5_handler = socks5_connect_sent; |
143 end | 143 end |
144 | 144 |
145 function socks5listener.onconnect(conn) | 145 function socks5listener.onconnect(conn) |
146 module:log("debug", "Connected to SOCKS5 proxy, sending SOCKS5 handshake."); | 146 module:log("debug", "Connected to SOCKS5 proxy, sending SOCKS5 handshake."); |
147 | 147 |
148 -- Socks version 5, 1 method, no auth | 148 -- Socks version 5, 1 method, no auth |
149 conn:send(c(5) .. c(1) .. c(0)); | 149 conn:write(c(5) .. c(1) .. c(0)); |
150 | 150 |
151 sessions[conn].socks5_handler = socks5_handshake_sent; | 151 sessions[conn].socks5_handler = socks5_handshake_sent; |
152 end | 152 end |
153 | 153 |
154 function socks5listener.register_outgoing(conn, session) | 154 function socks5listener.register_outgoing(conn, session) |