Comparing version 2.1.0 to 2.2.0
@@ -65,2 +65,8 @@ #!/usr/bin/env node | ||
}) | ||
.option('port-control', { | ||
description: 'Open repl controller at given port', | ||
type: 'number', | ||
alias: 'p', | ||
default: 0 | ||
}) | ||
.parse() | ||
@@ -67,0 +73,0 @@ |
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.2.0"></a> | ||
# [2.2.0](https://github.com/nodys/clussh/compare/v2.1.0...v2.2.0) (2018-05-02) | ||
### Features | ||
* Add controller ([56ecb0d](https://github.com/nodys/clussh/commit/56ecb0d)) | ||
<a name="2.1.0"></a> | ||
@@ -7,0 +17,0 @@ # [2.1.0](https://github.com/nodys/clussh/compare/v2.0.0...v2.1.0) (2018-04-30) |
@@ -6,2 +6,6 @@ const miss = require('mississippi') | ||
const ms = require('ms') | ||
const net = require('net') | ||
const replico = require('replico') | ||
const pkg = require('../package.json') | ||
const chalk = require('chalk') | ||
@@ -22,3 +26,4 @@ module.exports = clussh | ||
scale: 1, | ||
identity: [] | ||
identity: [], | ||
portControl: 0 | ||
}, config) | ||
@@ -65,2 +70,6 @@ | ||
if (config.portControl) { | ||
openControl(config.portControl) | ||
} | ||
function ensureWorker (uri) { | ||
@@ -202,3 +211,46 @@ let worker = workers.find(w => w.uri === uri) | ||
function openControl (portControl) { | ||
writeStream.log({ type: 'repl', msg: 'Call openControl', portControl: portControl }) | ||
// Repl | ||
net.createServer((socket) => { | ||
writeStream.log({ type: 'repl', msg: 'New control client', remoteAddress: socket.remoteAddress }) | ||
socket.write(chalk`{bold Clussh v${pkg.version}}`) | ||
let replServer = replico({ | ||
input: socket, | ||
output: socket, | ||
terminal: true | ||
}) | ||
function extendContext (context) { | ||
context.workers = workers | ||
context.config = config | ||
context.ensureWorker = ensureWorker | ||
context.bufferize = bufferize | ||
context.dispatch = dispatch | ||
} | ||
extendContext(replServer.context) | ||
replServer.on('reset', extendContext) | ||
replServer.on('exit', () => { | ||
socket.end() | ||
}) | ||
// replServer.defineCommand('chist', { | ||
// help: 'Clear history', | ||
// action: function () { | ||
// replServer.history = [] | ||
// this.displayPrompt() | ||
// } | ||
// }) | ||
// replServer.context.admin() | ||
}).listen(portControl, function () { | ||
writeStream.log({ type: 'repl', msg: `Server repl on port ${portControl} - pid: ${process.pid}`, port: portControl, pid: process.pid }) | ||
}) | ||
} | ||
return duplexStream | ||
} |
@@ -128,2 +128,3 @@ const PQueue = require('p-queue') | ||
this.stats.done++ | ||
this.server.down = false | ||
log({ type: 'success' }) | ||
@@ -130,0 +131,0 @@ }) |
{ | ||
"name": "clussh", | ||
"version": "2.1.0", | ||
"version": "2.2.0", | ||
"description": "Stream tasks to shell workers through ssh", | ||
@@ -64,2 +64,3 @@ "main": "index.js", | ||
"rc": "^1.2.3", | ||
"replico": "^0.1.1", | ||
"split2": "^2.2.0", | ||
@@ -66,0 +67,0 @@ "yargs": "^10.1.1" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38969
925
15
5
1
+ Addedreplico@^0.1.1
+ Addedbluebird@3.7.2(transitive)
+ Addedbluebird-co@2.2.0(transitive)
+ Addedreplico@0.1.2(transitive)