1
0
mirror of https://github.com/Ylianst/MeshCentralRouter synced 2025-12-06 00:13:33 +00:00

Fixed mapping issue when using ?key=

This commit is contained in:
Ylian Saint-Hilaire
2021-03-10 09:48:03 -08:00
parent aae71ece59
commit 2413b96350

View File

@@ -67,7 +67,13 @@ namespace MeshCentralRouter
mapper.inaddrany = inaddrany;
mapper.certhash = certhash;
mapper.onStateMsgChanged += Mapper_onStateMsgChanged;
string serverurl = "wss://" + host + "/meshrelay.ashx?nodeid=" + node.nodeid;
string serverurl;
int keyIndex = host.IndexOf("?key=");
if (keyIndex >= 0) {
serverurl = "wss://" + host.Substring(0, keyIndex) + "/meshrelay.ashx?nodeid=" + node.nodeid + "&key=" + host.Substring(keyIndex + 5);
} else {
serverurl = "wss://" + host + "/meshrelay.ashx?nodeid=" + node.nodeid;
}
if (protocol == 1) {
serverurl += ("&tcpport=" + remotePort);
if (remoteIP != null) { serverurl += "&tcpaddr=" + remoteIP; }