Beispiel #1
0
        public async Task Disconnect(string id)
        {
            var vpnId = VpnId.Parse(id);
            var stats = await VpnCli.GetStats();

            if (stats.Server == vpnId.Server)
            {
                await VpnCli.Disconnect();
            }
        }
        public async Task <IPAddress> GetIpAddress(string id)
        {
            var vpnId = VpnId.Parse(id);
            var stats = await VpnCli.GetStats();

            if (stats.Server == vpnId.Server && IPAddress.TryParse(stats.Ip, out var ipaddress))
            {
                return(ipaddress);
            }
            return(IPAddress.Any);
        }
        public async Task <VpnStatus> GetStatus(string id)
        {
            var vpnId = VpnId.Parse(id);
            var stats = await VpnCli.GetStats();

            if (stats.Server == vpnId.Server)
            {
                if (Enum.TryParse <VpnStatus>(stats.State, out var status))
                {
                    return(status);
                }
                return(VpnStatus.Unknown);
            }
            return(VpnStatus.Disconnected);
        }
Beispiel #4
0
 public async Task Connect(string id)
 {
     var vpnId = VpnId.Parse(id);
     await VpnCli.Connect(vpnId.Name, $"CiscoAnyConnect\\{vpnId.Name}.txt");
 }