https://github.com/mhozaifaa/openvpn-action
The most powerful management to handle ui events
https://github.com/mhozaifaa/openvpn-action
csharp management openvpn openvpn-client
Last synced: 6 months ago
JSON representation
The most powerful management to handle ui events
- Host: GitHub
- URL: https://github.com/mhozaifaa/openvpn-action
- Owner: MhozaifaA
- Created: 2021-06-04T22:10:48.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-06-21T18:28:01.000Z (over 4 years ago)
- Last Synced: 2025-02-02T07:28:42.364Z (8 months ago)
- Topics: csharp, management, openvpn, openvpn-client
- Language: C#
- Homepage:
- Size: 25.4 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# OpenVPN-action
The most powerful management to handle ui events## Quick start
```C#
using OpenVPN_action;
using OpenVPN_action.Enum;private readonly OpenVPNAction openVPN;
public ctor()
{
...
// pass your own username / password
openVPN = new OpenVPNAction(SecureSettingApp.GetEmail(), SecureSettingApp.GetPassword());
openVPN.NumCycleOfReconnecting = 3;
InitVPNEvent();
...
}
private void InitVPNEvent()
{
openVPN.OnConnecting += (info) => { ... };openVPN.OnConnected += (info) => { ... };
openVPN.OnReconnecting += (info) => { ... };
openVPN.OnDisconnected += (info) => { ... };openVPN.OnEndCycle += (info) => { ... };
openVPN.OnCorrupted += (info) =>
{
...
//optional
openVPN.RemoveRefuseRun();
...
};
}
private async ValueTask ConnectDisconnect()
{
...
var state = openVPN.OpenVPNInfo.GetConnectionState();if ((state == ConnectionStates.Disconnect ||
state == ConnectionStates.UnConfigured))
{
...
openVPN.Configuration(SettingApp.OpenVpn_Path, SettingApp.ovpnFile_Path);
await openVPN.Start();
await openVPN.Connect();
return;
}
if(state == ConnectionStates.Connecting)
{
IsBlockVPN = false;
await openVPN.Disconnect();
HasAllowVPN = true;
return;
}if (state == ConnectionStates.Connected)
{
...
await openVPN.Disconnect();
return;
}
...
}```
##### *simple scenario*
----## Documentation
soon with many uses