public bool StartTunnel(int port, EnumDictionary.Protocols protocol) { var request = "/tunnels"; var url = Server + BasicUrl + request; dynamic body = new JObject(); body.addr = port.ToString(); switch (protocol) { case EnumDictionary.Protocols.http: body.proto = "http"; break; case EnumDictionary.Protocols.tcp: body.proto = "tcp"; break; case EnumDictionary.Protocols.tls: body.proto = "tls"; break; } body.name = "local"; Post <Tunnel>(Server, url, body); return(true); }
public void StartTunnel(EnumDictionary.Protocols protocol, int port) { var task = new Task(() => { StartTunnelResult = _httpRequest.StartTunnel(port, protocol); ElaborationCompleted(new Utility.EventArgs { StartTunnelReceived = StartTunnelResult != null }); }); task.Start(); }