Files
localtunnel/bin/client
Roman Shtylman ed5aa3f16b remove server components
moved to localtunnel-server repo
2013-06-17 02:11:41 -04:00

35 lines
747 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'
})
.describe('port', 'internal http server port')
.argv;
var opt = {
host: argv.host,
port: argv.port,
subdomain: argv.subdomain,
}
var client = lt_client.connect(opt);
// only emitted when the url changes
client.on('url', function(url) {
console.log('your url is: %s', url);
});
client.on('error', function(err) {
console.error(err);
});
// vim: ft=javascript