Permalink
Browse files

drop error param in favor of error event

  • Loading branch information...
1 parent f12436b commit 9dadd11c9ba3995e2c42faa291b8b2c5cfb3f8fd @substack substack committed Dec 15, 2010
Showing with 8 additions and 5 deletions.
  1. +2 −1 lib/servers/index.js
  2. +3 −1 lib/servers/socks5.js
  3. +3 −3 test/proxy.js
View
3 lib/servers/index.js
@@ -1,3 +1,4 @@
module.exports = {
- socks5 : require('./socks5')
+ socks5 : require('./socks5'),
+ http : require('./socks5')
};
View
4 lib/servers/socks5.js
@@ -23,6 +23,8 @@ function session (stream, cb) {
Put().word8(5).word8(method).write(stream);
})
.loop(function (end) {
+ stream.on('end', end);
+
this
.word8('ver')
.word8('cmd')
@@ -67,7 +69,7 @@ function session (stream, cb) {
.word16bu('dst.port')
.tap(function (vars) {
var dst = vars.dst;
- cb(null, {
+ cb({
host : dst.addr,
port : dst.port,
}, stream);
View
6 test/proxy.js
@@ -14,11 +14,11 @@ exports.socks5 = function (assert) {
assert.fail('Never ended');
}, 500);
- var server = socks5.createServer(function (err, req, stream) {
+ var server = socks5.createServer(function (req, res) {
assert.eql(req.host, 'moo');
assert.eql(req.port, 8080);
- stream.write(new Buffer('oh hello'));
- stream.end();
+ res.write(new Buffer('oh hello'));
+ res.end();
});
server.listen(port, ready);

0 comments on commit 9dadd11

Please sign in to comment.