4 Commits

Author SHA1 Message Date
Roman Shtylman
3026d6a42c 1.2.0 2014-04-28 19:00:12 -04:00
Roman Shtylman
abd461f83a Merge pull request #47 from dscape/patch-1
return client from 'localtunnel' api call
2014-04-28 18:58:54 -04:00
Nuno Job
2acea3d77f Return client
This allows manipulating the client from outside. Allowing, for example, to close a connection.
2014-04-28 23:32:00 +01:00
Roman Shtylman
5d0eb3382a add --version CLI flag to get version info 2014-04-22 19:55:19 -04:00
3 changed files with 17 additions and 3 deletions

View File

@@ -3,7 +3,6 @@ var lt_client = require('../client');
var argv = require('optimist') var argv = require('optimist')
.usage('Usage: $0 --port [num]') .usage('Usage: $0 --port [num]')
.demand(['port'])
.options('host', { .options('host', {
default: 'http://localtunnel.me', default: 'http://localtunnel.me',
describe: 'upstream server providing forwarding' describe: 'upstream server providing forwarding'
@@ -14,16 +13,30 @@ var argv = require('optimist')
.options('local-host', { .options('local-host', {
describe: 'tunnel traffic to this host instead of localhost' describe: 'tunnel traffic to this host instead of localhost'
}) })
.options('version', {
describe: 'print version and exit'
})
.default('local-host', 'localhost') .default('local-host', 'localhost')
.describe('port', 'internal http server port') .describe('port', 'internal http server port')
.argv; .argv;
if (argv.version) {
console.log(require('../package.json').version);
process.exit(0);
}
if (argv.port == null) {
require('optimist').showHelp();
console.error('Missing required arguments: port');
process.exit(1);
}
var opt = { var opt = {
host: argv.host, host: argv.host,
port: argv.port, port: argv.port,
local_host: argv['local-host'], local_host: argv['local-host'],
subdomain: argv.subdomain, subdomain: argv.subdomain,
} };
lt_client(opt.port, opt, function(err, tunnel) { lt_client(opt.port, opt, function(err, tunnel) {
if (err) { if (err) {

View File

@@ -312,4 +312,5 @@ module.exports = function localtunnel(port, opt, fn) {
fn(null, client); fn(null, client);
}); });
return client;
}; };

View File

@@ -2,7 +2,7 @@
"author": "Roman Shtylman <shtylman@gmail.com>", "author": "Roman Shtylman <shtylman@gmail.com>",
"name": "localtunnel", "name": "localtunnel",
"description": "expose localhost to the world", "description": "expose localhost to the world",
"version": "1.1.2", "version": "1.2.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git://github.com/shtylman/localtunnel.git" "url": "git://github.com/shtylman/localtunnel.git"