示例#1
0
        public void Start()
        {
            routingStatusLabel.Text = "Starting...";
            appButton.Enabled       = (appId != 0);
            mapper                    = new MeshMapper();
            mapper.xdebug             = xdebug;
            mapper.inaddrany          = inaddrany;
            mapper.certhash           = certhash;
            mapper.onStateMsgChanged += Mapper_onStateMsgChanged;
            string serverurl = "wss://" + host + "/meshrelay.ashx?auth=" + Uri.EscapeDataString(authCookie) + "&nodeid=" + node.nodeid;

            if (protocol == 1)
            {
                serverurl += ("&tcpport=" + remotePort);
                if (remoteIP != null)
                {
                    serverurl += "&tcpaddr=" + remoteIP;
                }
            }
            else if (protocol == 2)
            {
                serverurl += ("&udpport=" + remotePort);
                if (remoteIP != null)
                {
                    serverurl += "&udpaddr=" + remoteIP;
                }
            }
            mapper.start(protocol, localPort, serverurl, remotePort, remoteIP);
            UpdateInfo();
        }
        public void Start()
        {
            routingStatusLabel.Text = Properties.Resources.Starting;
            appButton.Enabled       = (appId != 0);
            mapper                    = new MeshMapper();
            mapper.xdebug             = xdebug;
            mapper.inaddrany          = inaddrany;
            mapper.certhash           = certhash;
            mapper.onStateMsgChanged += Mapper_onStateMsgChanged;
            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;
                }
            }
            else if (protocol == 2)
            {
                serverurl += ("&udpport=" + remotePort);
                if (remoteIP != null)
                {
                    serverurl += "&udpaddr=" + remoteIP;
                }
            }
            mapper.start(parent.meshcentral, protocol, localPort, serverurl, remotePort, remoteIP);
            UpdateInfo();
        }