CoreAPI
Core methods that used for initialize tunnel
Note:
The returned structures are intended for internal use and are subject to change at any time.
Login
Logins to the backend for fetch AccessToken, for instance.
var sdk = new SDK();
var loginRequest = new LoginRequest
{
Method = AuthenticationMethod.Anonymous.ToString(),
Token = null,
};
var loginResponse = await sdk.LoginAsync(loginRequest).ConfigureAwait(false);
if (loginResponse.Result.Equals(ResponseResult.Ok))
{
Console.WriteLine(loginResponse.AccessToken);
}Logout
Logouts from backend.
GetUserInfo
Gets user info, like Name, UserId, DevicesLimit etc.
GetRemainingTraffic
This method allows users to retrieve their remaining traffic balance.
GetLocations
This method is used to retrieve a list of VPN locations and for multi-hop, custom DNS, and VPN profiles functionalities.
An example response looks as follows:
Connecting to Specific Locations using GetLocations
To connect to a specific location, you can use either the VpnCustomLocations property of the GetLocationsResponse. Here's how you can do it:
Searching for a Specific Location
If you want to connect to a location based on its name, you can search through the VpnCustomLocations list:
GetCredentials
Gets credentials for VPN tunnel, including HydraCertificate, OpenVpnCertificate, UserName and UserPassword etc.
StartVpn
All protocols (except IPSec) work on the Wintun adapter, which is created anew each time.
StartVpnSession
Combines GetCredentialsRequest and StartVpnRequest steps.
GetConnectionState
Gets current VPN connection state based on the VPN connection state stored in Unified SDK service.
The VPN connection state represents an Enum:
TunnelIdle - either doing nothing or trying to reconnect over and over again with no luck.
TunnelConnecting - establishing the connection.
TunnelConnected - connected to one or more servers and ready to process diverted network traffic.
TunnelDisconnected - disconnected from all the connected servers (if any) and not diverting network traffic.
GetConnectedServerInfo
Returns the connected server information. It will be one of the servers received from GetCredentials response. Tunnel should be in the TunnelConnected state, otherwise it will return an error.
StopVpn
Stops established VPN connection or cancel current connection/reconnection attempt.
Last updated
Was this helpful?