From 108faa1ac3f49b92d9cb4aa905b9c2293e3bdf8e Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Sat, 1 Sep 2018 22:32:39 -0700 Subject: [PATCH] Small server discovery fix --- meshscanner.js | 2 ++ sample-config.json | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/meshscanner.js b/meshscanner.js index 3b61ae1d..95daa865 100644 --- a/meshscanner.js +++ b/meshscanner.js @@ -140,11 +140,13 @@ module.exports.CreateMeshScanner = function (parent) { // Build the IPv4 response var url = (parent.args.notls ? 'ws' : 'wss') + '://%s:' + parent.args.port + '/agent.ashx'; obj.multicastPacket4 = Buffer.from("MeshCentral2|" + obj.agentCertificateHashHex + '|' + url, 'ascii'); + if (parent.certificates.CommonName != "un-configured") { url = (parent.args.notls ? 'ws' : 'wss') + '://' + parent.certificates.CommonName + ':' + parent.args.port + '/agent.ashx'; } obj.multicastPacket4x = Buffer.from("MeshCentral2|" + obj.agentCertificateHashHex + '|' + url + '|' + name + '|' + info, 'ascii'); // Build the IPv6 response url = (parent.args.notls ? 'ws' : 'wss') + '://[%s]:' + parent.args.port + '/agent.ashx'; obj.multicastPacket6 = Buffer.from("MeshCentral2|" + obj.agentCertificateHashHex + '|' + url, 'ascii'); + if (parent.certificates.CommonName != "un-configured") { url = (parent.args.notls ? 'ws' : 'wss') + '://' + parent.certificates.CommonName + ':' + parent.args.port + '/agent.ashx'; } obj.multicastPacket6x = Buffer.from("MeshCentral2|" + obj.agentCertificateHashHex + '|' + url + '|' + name + '|' + info, 'ascii'); setupServers(); diff --git a/sample-config.json b/sample-config.json index 1d8c67bf..f7dd519c 100644 --- a/sample-config.json +++ b/sample-config.json @@ -14,7 +14,8 @@ "_AllowFraming": true, "_WebRTC": false, "_ClickOnce": false, - "_UserAllowedIP" : "127.0.0.1,::1,192.168.0.100" + "_UserAllowedIP": "127.0.0.1,::1,192.168.0.100", + "_LocalDiscovery": { "name": "Local server name", "info": "Information about this server" } }, "_domains": { "": {