private void SendConnectionInfoMessage(OpenVPNConfiguration pConfig) { SendMessage(new ConnectionInfoMessage(pConfig.Index) { Data = pConfig.ConfigurationInfo }); }
public override void StartTunnel(NSDictionary <NSString, NSObject> options, Action <NSError> completionHandler) { Console.WriteLine("Vpn Start tunnel"); try { var data = options["Profile"].ToString(); Console.WriteLine("Config:-" + data); var config = new OpenVPNConfiguration { FileContent = NSData.FromString(data), TunPersist = true, ClockTick = 5000 }; var pr = vpnAdapter.ApplyConfiguration(config, out NSError nSError); if (nSError == null) { var credentials = new OpenVPNCredentials { Username = options["Username"].ToString(), Password = options["Password"].ToString() }; vpnAdapter.ProvideCredentials(credentials, out NSError error); vpnReachability.StartTrackingWithCallback(TrackVPN); vpnAdapter.Connect(); _connectedHandler = completionHandler; } else { Console.WriteLine("Start Error" + nSError.LocalizedDescription); } } catch (Exception ex) { Console.WriteLine("Start Exception" + ex.ToString()); } }
private void SendInterfaceChangedMessage(OpenVPNConfiguration pConfig, string pInterface) { SendConnectionInfoMessage(pConfig); }
private void SendRequestAuthInfoMessage(OpenVPNConfiguration pConfig) { SendMessage(new RequestAuthInfoMessage { Connection = pConfig.Index }); }
private void SendOutputRecievedMessage(OpenVPNConfiguration pConfig, OutputLine pLine) { SendMessage(new ConnectionOutputMessage { Connection = pConfig.Index, Data = pLine }); }
private void SendStatusChangedMessage(OpenVPNConfiguration pConfig, ConnectionStatus pStatus) { SendConnectionInfoMessage(pConfig); }