MOD: migrate, change some dependencies, changed regexp for subdomains
This commit is contained in:
+16
-24
@@ -1,42 +1,37 @@
|
||||
#!/usr/bin/env node -r esm
|
||||
#!/usr/bin/env node
|
||||
require('localenv');
|
||||
const yargs = require('yargs');
|
||||
const log = require('book');
|
||||
const Debug = require('debug');
|
||||
|
||||
import 'localenv';
|
||||
import optimist from 'optimist';
|
||||
|
||||
import log from 'book';
|
||||
import Debug from 'debug';
|
||||
|
||||
import CreateServer from '../server';
|
||||
const CreateServer = require('../server');
|
||||
|
||||
const debug = Debug('localtunnel');
|
||||
|
||||
const argv = optimist
|
||||
const { argv } = yargs
|
||||
.usage('Usage: $0 --port [num]')
|
||||
.options('secure', {
|
||||
default: false,
|
||||
.env(true)
|
||||
.option('secure', {
|
||||
describe: 'use this flag to indicate proxy over https'
|
||||
})
|
||||
.options('port', {
|
||||
.option('port', {
|
||||
default: '80',
|
||||
describe: 'listen on this port for outside requests'
|
||||
})
|
||||
.options('address', {
|
||||
.option('address', {
|
||||
default: '0.0.0.0',
|
||||
describe: 'IP address to bind to'
|
||||
})
|
||||
.options('domain', {
|
||||
.option('domain', {
|
||||
describe: 'Specify the base domain name. This is optional if hosting localtunnel from a regular example.com domain. This is required if hosting a localtunnel server from a subdomain (i.e. lt.example.dom where clients will be client-app.lt.example.come)',
|
||||
})
|
||||
.options('max-sockets', {
|
||||
.option('max-sockets', {
|
||||
default: 10,
|
||||
describe: 'maximum number of tcp sockets each client is allowed to establish at one time (the tunnels)'
|
||||
})
|
||||
.argv;
|
||||
|
||||
if (argv.help) {
|
||||
optimist.showHelp();
|
||||
process.exit();
|
||||
}
|
||||
.help('help', 'Show this help and exit')
|
||||
.boolean('secure')
|
||||
.require('port');
|
||||
|
||||
const server = CreateServer({
|
||||
max_tcp_sockets: argv['max-sockets'],
|
||||
@@ -63,6 +58,3 @@ process.on('uncaughtException', (err) => {
|
||||
process.on('unhandledRejection', (reason, promise) => {
|
||||
log.error(reason);
|
||||
});
|
||||
|
||||
// vim: ft=javascript
|
||||
|
||||
|
||||
Reference in New Issue
Block a user