Innovenergy_trunk/csharp/app/RemoteSupportConsole/VpnConnection.cs

25 lines
825 B
C#
Raw Normal View History

2023-02-16 12:57:06 +00:00
using InnovEnergy.Lib.Utils;
using InnovEnergy.Lib.Victron.VictronVRM;
using static System.ConsoleColor;
namespace InnovEnergy.RemoteSupportConsole;
public static class VpnConnection
{
public static async Task<Int32> Open(Installation installation, IReadOnlyList<Detail> details)
{
var machineSerial = details.MachineSerial(); // DEPRECATED
var installationId = installation.UniqueId;
var vpnIp = await VpnInfo.LookUpIp(installationId, machineSerial); // look up by InstallationId OR machineSerial
if (String.IsNullOrWhiteSpace(vpnIp))
return 1;
"Starting VPN connection with ".Write();
installation.Name.WriteLine(Green);
Console.WriteLine();
return await Ssh.Interactive(vpnIp, installation.Name, "root", "22");
}
}