From c6b264b29933bf1238cc5606a2a9cf8a73f302be Mon Sep 17 00:00:00 2001 From: jsastriawan Date: Mon, 26 Oct 2020 11:07:14 -0700 Subject: [PATCH] Add proxy support for connecting to Meshcentral Close proxysock on error and cleanup status on disconnect Add proxy detection logic to fill in proxy form --- amt-wsman-node-0.2.0.js | 4 +- index.html | 67 +++++++++- meshcentral-server-0.2.0.js | 95 +++++++++---- output/index.htm | 257 +++++++++++++++++++++++++++++------- websocket-wrapper-0.2.0.js | 91 ++++++++++--- 5 files changed, 422 insertions(+), 92 deletions(-) diff --git a/amt-wsman-node-0.2.0.js b/amt-wsman-node-0.2.0.js index 2c91229..75c6548 100644 --- a/amt-wsman-node-0.2.0.js +++ b/amt-wsman-node-0.2.0.js @@ -169,7 +169,9 @@ var CreateWsmanComm = function (host, port, user, pass, tls, tlsoptions) { if (obj.xtlsoptions && obj.xtlsoptions.meshServerConnect) { // Use the websocket wrapper to connect to MeshServer server - obj.socket = CreateWebSocketWrapper(obj.xtlsoptions.host, obj.xtlsoptions.port, '/webrelay.ashx?user=' + encodeURIComponent(obj.xtlsoptions.username) + '&pass=' + encodeURIComponent(obj.xtlsoptions.password) + '&host=' + encodeURIComponent(obj.host) + '&p=1&tls1only=' + obj.xtlsMethod, obj.xtlsoptions.xtlsFingerprint); + var http_proxy = null; + if (obj.xtlsoptions.useproxy == true) { http_proxy = obj.xtlsoptions.proxy + ':' + obj.xtlsoptions.proxyPort} + obj.socket = CreateWebSocketWrapper(obj.xtlsoptions.host, obj.xtlsoptions.port, '/webrelay.ashx?user=' + encodeURIComponent(obj.xtlsoptions.username) + '&pass=' + encodeURIComponent(obj.xtlsoptions.password) + '&host=' + encodeURIComponent(obj.host) + '&p=1&tls1only=' + obj.xtlsMethod, obj.xtlsoptions.xtlsFingerprint, http_proxy); obj.socket.setEncoding('binary'); obj.socket.setTimeout(6000); // Set socket idle timeout obj.socket.ondata = obj.xxOnSocketData; diff --git a/index.html b/index.html index 483adc9..ca6e39f 100644 --- a/index.html +++ b/index.html @@ -1709,7 +1709,7 @@

Software KVM