mirror of
https://github.com/bitinflow/localtunnel.git
synced 2026-03-13 13:35:54 +00:00
41 lines
920 B
JavaScript
Executable File
41 lines
920 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
var lt_client = require('../client');
|
|
|
|
var argv = require('optimist')
|
|
.usage('Usage: $0 --port [num]')
|
|
.demand(['port'])
|
|
.options('host', {
|
|
default: 'http://localtunnel.me',
|
|
describe: 'upstream server providing forwarding'
|
|
})
|
|
.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,
|
|
}
|
|
|
|
lt_client(opt.port, opt, function(err, tunnel) {
|
|
if (err) {
|
|
throw err;
|
|
}
|
|
|
|
console.log('your url is: %s', tunnel.url);
|
|
|
|
tunnel.on('error', function(err) {
|
|
throw err;
|
|
});
|
|
});
|
|
|
|
// vim: ft=javascript
|