start server.js in cluster mode

This commit is contained in:
VincentChanX
2017-04-07 16:04:38 +08:00
parent 0a8481de48
commit 3bf624f397
12 changed files with 1300 additions and 70 deletions

View File

@@ -1,14 +1,17 @@
const TCPRelay = require('./tcprelay').TCPRelay;
const local = require('commander');
const constants = require('./constants');
local
.version('0.1.4')
.option('-m --method [method]', 'encryption method, default: aes-256-cfb')
.option('-k --password [password]', 'password')
.option('-s --server-address [address]', 'server address')
.option('-p --server-port [port]', 'server port, default: 8388')
.option('-b --local-address [address]', 'local binding address, default: 127.0.0.1')
.option('-l --local-port [port]', 'local port, default: 1080')
.version(constants.VERSION)
.option('-m --method <method>', 'encryption method, default: aes-256-cfb')
.option('-k --password <password>', 'password')
.option('-s --server-address <address>', 'server address')
.option('-p --server-port <port>', 'server port, default: 8388')
.option('-b --local-address <address>', 'local binding address, default: 127.0.0.1')
.option('-l --local-port <port>', 'local port, default: 1080')
.option('--log-level <level>', 'log level(debug|info|warn|error|fatal)', /^(debug|info|warn|error|fatal)$/i, 'info')
.option('--log-file <file>', 'log file')
.parse(process.argv);
var relay = new TCPRelay({
@@ -18,5 +21,7 @@ var relay = new TCPRelay({
serverPort: local.serverPort || 8388,
password: local.password || 'shadowsocks-over-websocket',
method: local.method || 'aes-256-cfb'
}, true, 'info');
}, true);
relay.setLogLevel(local.logLevel);
relay.setLogFile(local.logFile);
relay.bootstrap();