mirror of
https://github.com/bitinflow/localtunnel.git
synced 2026-03-14 05:55:53 +00:00
Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f97434a69 | ||
|
|
a46cd02fcb | ||
|
|
792d9f19bd | ||
|
|
d0b483b92b | ||
|
|
59d96a3cc6 | ||
|
|
b516ecccfa | ||
|
|
f68b1f06d9 | ||
|
|
4d09875163 | ||
|
|
2773fe6923 | ||
|
|
457bd64ecc | ||
|
|
eb31659345 | ||
|
|
3ee8b1b884 | ||
|
|
15aac729bb | ||
|
|
e73cfe3e45 |
@@ -1,3 +1,12 @@
|
||||
# 1.7.0 (2015-07-22)
|
||||
|
||||
* add short arg options
|
||||
|
||||
# 1.6.0 (2015-05-15)
|
||||
|
||||
* keep sockets alive after connecting
|
||||
* add --open param to CLI
|
||||
|
||||
# 1.5.0 (2014-10-25)
|
||||
|
||||
* capture all errors on remote socket and restart the tunnel
|
||||
|
||||
50
bin/client
50
bin/client
@@ -1,32 +1,38 @@
|
||||
#!/usr/bin/env node
|
||||
var lt_client = require('../client');
|
||||
var open_url = require('openurl');
|
||||
|
||||
var argv = require('optimist')
|
||||
.usage('Usage: $0 --port [num]')
|
||||
.options('host', {
|
||||
default: 'http://localtunnel.me',
|
||||
describe: 'upstream server providing forwarding'
|
||||
var argv = require('yargs')
|
||||
.usage('Usage: $0 --port [num] <options>')
|
||||
.option('h', {
|
||||
alias: 'host',
|
||||
describe: 'Upstream server providing forwarding',
|
||||
default: 'http://localtunnel.me'
|
||||
})
|
||||
.options('subdomain', {
|
||||
describe: 'request this subdomain'
|
||||
.option('s', {
|
||||
alias: 'subdomain',
|
||||
describe: 'Request this subdomain'
|
||||
})
|
||||
.options('local-host', {
|
||||
describe: 'tunnel traffic to this host instead of localhost, override Host header to this host'
|
||||
.option('l', {
|
||||
alias: 'local-host',
|
||||
describe: 'Tunnel traffic to this host instead of localhost, override Host header to this host'
|
||||
})
|
||||
.options('version', {
|
||||
describe: 'print version and exit'
|
||||
.options('o', {
|
||||
alias: 'open',
|
||||
describe: 'opens url in your browser'
|
||||
})
|
||||
.describe('port', 'internal http server port')
|
||||
.option('p', {
|
||||
alias: 'port',
|
||||
describe: 'Internal http server port',
|
||||
})
|
||||
.require('port')
|
||||
.help('help', 'Show this help and exit')
|
||||
.version(require('../package').version)
|
||||
.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');
|
||||
if (typeof argv.port !== 'number') {
|
||||
require('yargs').showHelp();
|
||||
console.error('port must be a number');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -44,6 +50,10 @@ lt_client(opt.port, opt, function(err, tunnel) {
|
||||
|
||||
console.log('your url is: %s', tunnel.url);
|
||||
|
||||
if (argv.open) {
|
||||
open_url.open(tunnel.url);
|
||||
}
|
||||
|
||||
tunnel.on('error', function(err) {
|
||||
throw err;
|
||||
});
|
||||
|
||||
@@ -73,6 +73,10 @@ Tunnel.prototype._init = function(cb) {
|
||||
Tunnel.prototype._establish = function(info) {
|
||||
var self = this;
|
||||
var opt = self._opt;
|
||||
|
||||
// increase max event listeners so that localtunnel consumers don't get
|
||||
// warning messages as soon as they setup even one listener. See #71
|
||||
self.setMaxListeners(info.max_conn + (EventEmitter.defaultMaxListeners || 10));
|
||||
|
||||
info.local_host = opt.local_host;
|
||||
info.local_port = opt.port;
|
||||
|
||||
@@ -38,6 +38,8 @@ TunnelCluster.prototype.open = function() {
|
||||
port: remote_port
|
||||
});
|
||||
|
||||
remote.setKeepAlive(true);
|
||||
|
||||
remote.on('error', function(err) {
|
||||
// emit connection refused errors immediately, because they
|
||||
// indicate that the tunnel can't be established.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"author": "Roman Shtylman <shtylman@gmail.com>",
|
||||
"name": "localtunnel",
|
||||
"description": "expose localhost to the world",
|
||||
"version": "1.5.1",
|
||||
"version": "1.7.0",
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -10,8 +10,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"request": "2.11.4",
|
||||
"optimist": "0.3.4",
|
||||
"debug": "0.7.4"
|
||||
"yargs": "3.15.0",
|
||||
"debug": "0.7.4",
|
||||
"openurl": "1.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "~1.17.0"
|
||||
@@ -23,4 +24,4 @@
|
||||
"lt": "./bin/client"
|
||||
},
|
||||
"main": "./client.js"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user