Hydra VPN SDK for Windows
This is the SDK targeting .NET Framework 4.5 that helps to easily develop Windows application with required Hydra custom VPN protocol support.
Download the last version of the SDK
Requirements
Windows 7 or later
.NET Framework 4.5
Files
HydraExecutable\x32bit\afvpn.dll
HydraExecutable\x32bit\hydra.exe
HydraExecutable\x64bit\afvpn.dll
HydraExecutable\x64bit\hydra.exe
TapDriver\x32\AFTap.inf
TapDriver\x32\aftap0901.cat
TapDriver\x32\aftap0901.sys
TapDriver\x32\OemVista.inf
TapDriver\x32\tap0901.cat
TapDriver\x32\tap0901.sys
TapDriver\x32\tapinstall.exe
TapDriver\x64\AFTap.inf
TapDriver\x64\aftap0901.cat
TapDriver\x64\aftap0901.sys
TapDriver\x64\OemVista.inf
TapDriver\x64\tap0901.cat
TapDriver\x64\tap0901.sys
TapDriver\x64\tapinstall.exe
afvpn.manifest
afvpn.tlb
Foundation.ExtProc.Hydra.ComTypes.dll
Hydra.Sdk.Windows.dll
Hydra.Sdk.Windows.Service.exe
Newtonsoft.Json.dll
PartnerApi.dll
System.Buffers.dll
System.Collections.Immutable.dll
System.Memory.dll
System.Runtime.CompilerServices.Unsafe.dll
System.Threading.Tasks.Extensions.dll
System.ValueTuple.dll
Preconditions
TAP driver installation
TAP driver installation requires administrator permissions. For windows 7, 8 and 8.1 execute the following command:
and for Windows 10:
Windows service installation
To be able to use the Hydra service, you need to install it into the system once. It could be done by the following command:
where serviceName
is the name of your service.
Working with Hydra SDK
References
Your project have to reference next libraries:
Hydra.Sdk.Windows.dll
PartnerApi.dll
There is no need to reference other files, but they should be located in the same directory keeping file structure for a sub-folder named HydraExecutable
.
Initialization
Before you can use Hydra SDK in your application you have to initialize it:
CarrierId
is your project ID from the developer
BackendAddress
is URL address to work with our backend.
DeviceId
is a unique identifier of an application installation. NOTE: you can use anything as an ID, but it must be unique for your carrier.
Authentication
There two ways how you can login. The first one is anonymous:
The second one is OAuth2. If you have your custom OAuth2 service:
Also, the SDK supports 3d-party token providers:
An example of login implementation:
Connection
After a successful login, you can start a VPN connection, but first you have to get available VPN nodes. An example of connect implementation:
To stop the connection:
Events
VpnConnectionStateChanged
VpnConnectionStateChanged
Occurs when the SDK changes its state. ConnectionStateChangedEventArgs
contains two properties:
VpnConnectionState State
is the current state of the SDK. Possible values are:
Disconnected
Connected
Connecting
Disconnecting
bool IsError
is a flag that shows if the state was changed because of an error. Can be true
only for Disconnected
state.
StatisticsChanged
StatisticsChanged
Occurs when the SDK detects traffic counter changes on the client side. VpnStatisticsChangedEventArgs
contains one property VpnStatistics Data
with two metrics:
long BytesSent
long BytesReceived
Setting up logging
Key places of Hydra SDK are instrumented with logging for debug purposes. If you need to see those log messages, you have to provide your own LoggerListener
.
First, create class derived from BaseLoggerListener
and implement abstract methods:
Then add an instance of your logger listener as handler to the HydraLogger:
That's all. You will get log output of your logger.
Console application example
Release notes
1.4.0.277 -> 1.4.1.285
'Connecting' state occurs faster
The following libraries were removed: Microsoft.Practices.ServiceLocation.dll, Microsoft.Practices.Unity.Configuration.dll, Microsoft.Practices.Unity.dll, Microsoft.Practices.Unity.RegistrationByConvention.dll, SimpleWifi.dll
General bug fixes and improvements
Last updated