From 2d725e9fe05df9f9745a1f31304b9b7cdf419878 Mon Sep 17 00:00:00 2001 From: billchurch Date: Tue, 12 Dec 2017 15:02:19 -0500 Subject: [PATCH] implement global keep alive option keepaliveInterval in config.json. time in ms, 0=disable --- app.js | 3 ++- config.json | 3 ++- socket.js | 1 + 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 54441bb..950a7bf 100644 --- a/app.js +++ b/app.js @@ -54,7 +54,8 @@ app.get('/ssh/host/:host?', function (req, res, next) { }, readyTimeout: (validator.isInt(req.query.readyTimeout + '', {min: 1, max: 300000}) && req.query.readyTimeout) || config.ssh.readyTimeout, - verify: config.verify || false + verify: config.verify || false, + keepaliveInterval: config.keepaliveInterval || 0 } if (req.session.ssh.header.name) validator.escape(req.session.ssh.header.name) if (req.session.ssh.header.background) validator.escape(req.session.ssh.header.background) diff --git a/config.json b/config.json index 738373a..d8b06ad 100644 --- a/config.json +++ b/config.json @@ -59,5 +59,6 @@ "server": false // not yet implemented }, "accesslog": false, // http style access logging to console.log - "verify": false // verification of host key hashes, see hostkeyhashes.json + "verify": false, // verification of host key hashes, see hostkeyhashes.json + "keepaliveInterval": 0 // value in milliseconds, 0 = disable } diff --git a/socket.js b/socket.js index c07cacd..d9af678 100644 --- a/socket.js +++ b/socket.js @@ -130,6 +130,7 @@ module.exports = function socket (socket) { return (noverify = true) } }, + keepaliveInterval: socket.request.session.ssh.keepaliveInterval, debug: debug('ssh2') }) } else {