From 21df257d167185eb5b63969e8285a19e10f4e87a Mon Sep 17 00:00:00 2001 From: Omri Bahumi Date: Thu, 14 Nov 2013 15:44:50 +0200 Subject: [PATCH] Added the --local-host parameter to tunnel the traffic to other hosts --- bin/client | 5 +++++ client.js | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/bin/client b/bin/client index 427bd02..4b4a9bd 100755 --- a/bin/client +++ b/bin/client @@ -11,12 +11,17 @@ var argv = require('optimist') .options('subdomain', { describe: 'request this subdomain' }) + .options('local-host', { + describe: 'tunnel traffic to this host instead of localhost' + }) + .default('local-host', 'localhost') .describe('port', 'internal http server port') .argv; var opt = { host: argv.host, port: argv.port, + local_host: argv['local-host'], subdomain: argv.subdomain, } diff --git a/client.js b/client.js index 285f7d0..748efd0 100644 --- a/client.js +++ b/client.js @@ -19,6 +19,9 @@ var request_url = function(params, cb) { var connect = function(opt) { var ev = new EventEmitter(); + // local host + var local_host = opt.local_host; + // local port var local_port = opt.port; @@ -39,7 +42,7 @@ var connect = function(opt) { }; var local_opt = { - host: 'localhost', + host: local_host, port: local_port };