• Articles
  • API Documentation
Search Results for

    Show / Hide Table of Contents
    • VpnSDK
      • AccountMetadataException
      • APIException
      • ApiTimeoutException
      • AuthenticationException
      • BaseSDKException
      • ConnectionAlreadyEstablishedException
      • ConnectionConfigurationBuilderBase
      • ConnectionException
      • ConnectionTerminatedException
      • CoreException
      • DataTransferEventArgs
      • DnsConfigurationException
      • DoubleHopException
      • DoubleHopNotAvailableException
      • EmptyAvailableVpnProtocolsException
      • EndpointsUnreachableException
      • FetchLocationsException
      • HTTPException
      • InvalidAccountException
      • InvalidConfigurationException
      • InvalidDoubleHopConfigurationException
      • InvalidServerException
      • NotAuthorizedException
      • NotElevatedException
      • NullLocationException
      • OAuthException
      • OpenVpnConnectionConfigurationBuilder
      • RasConnectionConfigurationBuilder
      • ReconnectOnPowerEventException
      • SDKBuilder<T>
      • SDKChangeEventHandler<T>
      • SDKEventHandler
      • SDKEventHandler<T>
      • SDKOperationEventHandler
      • SDKOperationEventHandler<T>
      • ServerListException
      • TapAdapterException
      • UnknownErrorException
      • UnsupportedProtocolException
      • VPNAuthenticationException
      • VpnException
      • VpnHostServiceException
      • VpnHostServiceFileNotFoundException
      • WFPException
      • WireGuardAPIException
      • WireGuardConnectionConfigurationBuilder
    • VpnSDK.Common.Dns
      • DnsResolutionResult
      • IDnsRequestResolver
    • VpnSDK.Common.Enums
      • SplitTunnelMode
    • VpnSDK.Common.Settings
      • SplitTunnelApp
      • SplitTunnelDomain
    • VpnSDK.DTO
      • ApiHttpError
      • ApiProxyError
      • ConnectionError
      • ISDKError
      • NetworkGeolocation
      • OpenVpnConfiguration
      • RasConfiguration
      • WireguardConfiguration
    • VpnSDK.Enums
      • AccountStatus
      • AuthenticationStatus
      • ConnectionStatus
      • DnsFilteringMode
      • DriverInstallResult
      • DriverUninstallResult
      • ErrorType
      • LoadLevel
      • NetworkConnectionType
      • NetworkProtocolType
      • OpenVpnCipherType
      • OpenVpnLogLevel
      • OperationStatus
      • RefreshLocationListStatus
    • VpnSDK.Extensions
      • ExceptionExtensions
      • LocationExtensions
      • RegionLoadChecker
    • VpnSDK.Helpers
      • BatchPingUtility
      • VersionHelper
      • VpnProtocolDiagnostics
    • VpnSDK.Interfaces
      • IBestAvailable
      • IConnectionConfiguration
      • IConnectionInfo
      • IDoubleHopConfiguration
      • ILocation
      • IOpenVpnConnectionConfiguration
      • IRasConnectionConfiguration
      • IRegion
      • ISDK
      • IUser
      • IWireGuardConnectionConfiguration

    Interface ISDK

    Interface ISDK. Provides an interface for the SDK APIs.

    Namespace: VpnSDK.Interfaces
    Assembly: cs.temp.dll.dll
    Syntax
    public interface ISDK : INotifyPropertyChanged, IDisposable

    Properties

    ActiveConnectionInformation

    Gets the active connection information.

    Declaration
    IConnectionInfo ActiveConnectionInformation { get; }
    Property Value
    Type Description
    IConnectionInfo

    The active connection information, null if not connected.

    AllowLANTraffic

    Gets or sets a value indicating whether to allow LAN traffic even when AllowOnlyVPNConnectivity is enabled.

    Declaration
    bool AllowLANTraffic { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if [allow LAN traffic]; otherwise, false.

    AllowLocalAdaptersWhenConnected

    Gets or sets a value indicating whether to allow local network adapters when connected to a VPN.

    Declaration
    bool AllowLocalAdaptersWhenConnected { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if [allow local adapters when connected]; otherwise, false.

    Remarks

    If this property is false, the traffic won't be able to leak through any other network adapter. The only network adapter allowed to send and receive traffic will be a VPN adapter. If this property is true, the local adapters won't be banned. LAN access will be available, but the chance of IP address leak will be higher.

    AllowOnlyVPNConnectivity

    Gets or sets a value indicating whether to allow only VPN connectivity and block standard Internet connections.

    Declaration
    bool AllowOnlyVPNConnectivity { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if [allow only VPN connectivity]; otherwise, false.

    AvailableProtocols

    Gets the available VPN types.

    Declaration
    Dictionary<NetworkConnectionType, bool> AvailableProtocols { get; }
    Property Value
    Type Description
    Dictionary<NetworkConnectionType, System.Boolean>

    A dictionary where the key is what protocol and the value is whether it's available.

    BrandingInfo

    Gets the branding info for the brand. This property is null if branding info is not set for this particular brand.

    Declaration
    IBrandingInfo BrandingInfo { get; }
    Property Value
    Type Description
    VpnSDK.Interfaces.IBrandingInfo

    CurrentNetworkGeolocation

    Gets the current network geolocation.

    Declaration
    NetworkGeolocation CurrentNetworkGeolocation { get; }
    Property Value
    Type Description
    NetworkGeolocation

    The current network geolocation when established, else null.

    DisableDNSLeakProtection

    Gets or sets a value indicating whether to disable DNS leak protection.

    Declaration
    bool DisableDNSLeakProtection { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if DNS leak protection is disabled otherwise, false.

    DisableIPv6LeakProtection

    Gets or sets a value indicating whether to disable IPv6 leak protection.

    Declaration
    bool DisableIPv6LeakProtection { get; set; }
    Property Value
    Type Description
    System.Boolean

    true if IPv6 leak protection is disabled otherwise, false.

    DnsFilterMode

    Gets or sets the DNS filtering mode.

    Declaration
    DnsFilteringMode DnsFilterMode { get; set; }
    Property Value
    Type Description
    DnsFilteringMode

    DnsRequestResolver

    Gets or sets the external DNS resolver used for resolving domain names to IP addresses.

    Declaration
    IDnsRequestResolver DnsRequestResolver { get; set; }
    Property Value
    Type Description
    IDnsRequestResolver

    The external DNS resolver.

    IsConnected

    Gets a value indicating whether VPN connection established.

    Declaration
    bool IsConnected { get; }
    Property Value
    Type Description
    System.Boolean

    IsConnecting

    Gets a value indicating whether SDK is in the process of establishing a new connection.

    Declaration
    bool IsConnecting { get; }
    Property Value
    Type Description
    System.Boolean

    IsConnectionCancelled

    Gets a value indicating whether VPN connection process was canceled.

    Declaration
    bool IsConnectionCancelled { get; }
    Property Value
    Type Description
    System.Boolean

    IsDisconnecting

    Gets a value indicating whether SDK is disconnecting from VPN server.

    Declaration
    bool IsDisconnecting { get; }
    Property Value
    Type Description
    System.Boolean

    IsDisposed

    Gets a value indicating whether object is disposed.

    Declaration
    bool IsDisposed { get; }
    Property Value
    Type Description
    System.Boolean

    IsElevated

    Gets a value indicating whether the running process is elevated.

    Declaration
    bool IsElevated { get; }
    Property Value
    Type Description
    System.Boolean

    IsSplitTunnelEnabled

    Gets or sets a value indicating whether split tunneling is enabled.

    Declaration
    bool IsSplitTunnelEnabled { get; set; }
    Property Value
    Type Description
    System.Boolean

    IsTapDriverInstalled

    Gets a value indicating whether TAP driver installed.

    Declaration
    bool IsTapDriverInstalled { get; }
    Property Value
    Type Description
    System.Boolean

    Locations

    Gets the read only observable collection responsible for locations.

    Declaration
    ReadOnlyObservableCollection<ILocation> Locations { get; }
    Property Value
    Type Description
    ReadOnlyObservableCollection<ILocation>

    The locations.

    SplitTunnelAllowedApps

    Gets or sets the list of allowed applications for split tunneling.

    Declaration
    List<SplitTunnelApp> SplitTunnelAllowedApps { get; set; }
    Property Value
    Type Description
    List<SplitTunnelApp>

    SplitTunnelAllowedDomains

    Gets or sets a collection of allowed domains for split tunneling.

    Declaration
    List<SplitTunnelDomain> SplitTunnelAllowedDomains { get; set; }
    Property Value
    Type Description
    List<SplitTunnelDomain>

    SplitTunnelMode

    Gets or sets the mode for split tunneling.

    Declaration
    SplitTunnelMode SplitTunnelMode { get; set; }
    Property Value
    Type Description
    SplitTunnelMode

    TapDriverDescription

    Gets a value of driver description.

    Declaration
    string TapDriverDescription { get; }
    Property Value
    Type Description
    System.String

    User

    Gets the user which was logged in. This property is null if user was not authorized.

    Declaration
    IUser User { get; }
    Property Value
    Type Description
    IUser

    VpnNetworkInterfaceMetricValue

    Gets or sets the metric for the VPN network interface for OpenVPN and WireGuard protocols.

    Declaration
    uint? VpnNetworkInterfaceMetricValue { get; set; }
    Property Value
    Type Description
    System.Nullable<System.UInt32>
    Remarks

    The metric is used to determine the priority of the network interface when routing network traffic. A lower metric value indicates a higher priority.

    Methods

    Connect(IEnumerable<ILocation>, IEnumerable<IConnectionConfiguration>, CancellationToken)

    Connects the user to the best VPN location in an enumerable using the protocol configurations provided in connectionConfigurations list.

    Declaration
    Task Connect(IEnumerable<ILocation> locations, IEnumerable<IConnectionConfiguration> connectionConfigurations, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IEnumerable<ILocation> locations

    The target locations.

    IEnumerable<IConnectionConfiguration> connectionConfigurations

    The list of protocol configurations for the connection.

    CancellationToken cancellationToken

    The cancellation token responsible for canceling the connection.

    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    Exceptions
    Type Condition
    UnsupportedProtocolException

    ConnectionType is not supported.

    VPNAuthenticationException

    VPN server rejected credentials.

    VPNAuthenticationException

    User not logged in.

    HTTPException

    User account became invalidated.

    VPNAuthenticationException

    VPN authorization failed. Please try connecting to a different location.

    Connect(IEnumerable<ILocation>, IConnectionConfiguration, CancellationToken)

    Connects the user to the best VPN location in an enumerable using the specified configuration.

    Declaration
    Task Connect(IEnumerable<ILocation> locations, IConnectionConfiguration connectionConfiguration, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    IEnumerable<ILocation> locations

    The target locations.

    IConnectionConfiguration connectionConfiguration

    The protocol configuration parameters for the connection.

    CancellationToken cancellationToken

    The cancellation token responsible for canceling the connection.

    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    Exceptions
    Type Condition
    UnsupportedProtocolException

    ConnectionType is not supported.

    VPNAuthenticationException

    VPN server rejected credentials.

    VPNAuthenticationException

    User not logged in.

    HTTPException

    User account became invalidated.

    VPNAuthenticationException

    VPN authorization failed. Please try connecting to a different location.

    Connect(ILocation, IEnumerable<IConnectionConfiguration>, CancellationToken)

    Connects the user to the best VPN location using the protocol configurations provided in connectionConfigurations list.

    Declaration
    Task Connect(ILocation location, IEnumerable<IConnectionConfiguration> connectionConfigurations, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    ILocation location

    The target location.

    IEnumerable<IConnectionConfiguration> connectionConfigurations

    The list of protocol configurations for the connection.

    CancellationToken cancellationToken

    The cancellation token responsible for canceling the connection.

    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    Remarks

    SDK tries to connect to a VPN server using first protocol configuration provided in connectionConfigurations list. If it fails to connect, SDK will try the next protocol configuration in the list. This process will be repeated until the end of the list is hit.

    Exceptions
    Type Condition
    UnsupportedProtocolException

    ConnectionType is not supported.

    VPNAuthenticationException

    VPN server rejected credentials.

    VPNAuthenticationException

    User not logged in.

    HTTPException

    User account became invalidated.

    VPNAuthenticationException

    VPN authorization failed. Please try connecting to a different location.

    Connect(ILocation, IConnectionConfiguration, CancellationToken)

    Connects the user to the VPN location specified using the specified configuration.

    Declaration
    Task Connect(ILocation location, IConnectionConfiguration connectionConfiguration, CancellationToken cancellationToken = null)
    Parameters
    Type Name Description
    ILocation location

    The target location.

    IConnectionConfiguration connectionConfiguration

    The protocol configuration parameters for the connection.

    CancellationToken cancellationToken

    The cancellation token responsible for canceling the connection.

    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    Exceptions
    Type Condition
    UnsupportedProtocolException

    ConnectionType is not supported.

    VPNAuthenticationException

    VPN server rejected credentials.

    VPNAuthenticationException

    User not logged in.

    HTTPException

    User account became invalidated.

    VPNAuthenticationException

    VPN authorization failed. Please try connecting to a different location.

    Disconnect()

    Disconnects the user from the active VPN connection.

    Declaration
    Task Disconnect()
    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    DisposeAsync()

    Disposes SDK asynchronously. If there's an active VPN connection, SDK will gently close it and clean up all the resources.

    Declaration
    Task DisposeAsync()
    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    Remarks

    Use this method, for example, on application exit. This will help to keep the app responsive.

    GetAccountMetadata()

    Gets the metadata values for account.

    Declaration
    Task<Dictionary<string, string>> GetAccountMetadata()
    Returns
    Type Description
    Task<Dictionary<System.String, System.String>>

    Metadata associated with account.

    GetActiveVpnConnectionName()

    Gets active VPN connection name.

    Declaration
    string GetActiveVpnConnectionName()
    Returns
    Type Description
    System.String

    Active VPN connection name.

    GetBrandingInfo(String)

    Gets branding information.

    Declaration
    Task<IBrandingInfo> GetBrandingInfo(string slugOrDomain)
    Parameters
    Type Name Description
    System.String slugOrDomain

    Brand's slug or domain name.

    Returns
    Type Description
    Task<VpnSDK.Interfaces.IBrandingInfo>

    A System.Threading.Tasks.Task.

    InstallTapDriver()

    Installs the OpenVPN TAP driver. Removes existing TAP drivers if already installed.

    Declaration
    Task<DriverInstallResult> InstallTapDriver()
    Returns
    Type Description
    Task<DriverInstallResult>

    Task<DriverInstallResult>.

    Exceptions
    Type Condition
    NotElevatedException

    Thrown when the running process is not elevated.

    UnsupportedProtocolException

    Thrown when OpenVPN protocol is not available.

    NotElevatedException

    This feature only works when the running process is elevated.

    UnsupportedProtocolException

    SDK is configured for running user space only. TAP Driver cannot be set up from user space.

    UnsupportedProtocolException

    OpenVPN is not available.

    Login(String, String)

    Logs in the specified username and password against the WLVPN API.

    Declaration
    Task Login(string username, string password)
    Parameters
    Type Name Description
    System.String username

    The username.

    System.String password

    The password.

    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    Exceptions
    Type Condition
    HTTPException

    Connection already in progress.

    ServerListException

    Failed to retrieve server list.

    Login(String, String, String)

    Logs in the specified username and password against the WLVPN API. Before doing this type of log in, SDK does branding API request using a slug/brand or domain provided.

    Declaration
    Task Login(string username, string password, string slugOrDomain)
    Parameters
    Type Name Description
    System.String username

    The username.

    System.String password

    The password.

    System.String slugOrDomain

    Brand's slug or domain name.

    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    LoginWithAuthTokens(String, String)

    Declaration
    Task LoginWithAuthTokens(string accessToken, string refreshToken)
    Parameters
    Type Name Description
    System.String accessToken
    System.String refreshToken
    Returns
    Type Description
    Task

    LoginWithAuthTokens(String, String, String)

    Declaration
    Task LoginWithAuthTokens(string accessToken, string refreshToken, string slugOrDomain)
    Parameters
    Type Name Description
    System.String accessToken
    System.String refreshToken
    System.String slugOrDomain
    Returns
    Type Description
    Task

    Logout()

    Logs out the current user.

    Declaration
    Task Logout()
    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    RefreshServerInfo()

    Refreshes the server info manually.

    Declaration
    Task<bool> RefreshServerInfo()
    Returns
    Type Description
    Task<System.Boolean>

    A System.Threading.Tasks.Task that returns a bool indicating if the server info refresh executed or not. If it false is returned, then you tried to call the task twice or more times within 5 minute interval.

    Remarks

    Can be called once in 5 minutes.

    Exceptions
    Type Condition
    NotAuthorizedException

    No user logged in to refresh server info.

    ServerListException

    Failed to retrieve server list.

    RefreshUserToken()

    Refreshes the user token manually.

    Declaration
    Task RefreshUserToken()
    Returns
    Type Description
    Task

    A System.Threading.Tasks.Task.

    Exceptions
    Type Condition
    NotAuthorizedException

    No user logged in to refresh.

    HTTPException

    User account became invalidated.

    SaveAccountMetadata(Dictionary<String, String>)

    Set the metadata values for account.

    Declaration
    Task<bool> SaveAccountMetadata(Dictionary<string, string> metadata)
    Parameters
    Type Name Description
    Dictionary<System.String, System.String> metadata
    Returns
    Type Description
    Task<System.Boolean>

    True, if metadata saved successfully, otherwise False.

    SetDnsMonitorConfig(DnsMonitoringConfig)

    Set the DNS Monitor related configuration.

    Declaration
    void SetDnsMonitorConfig(DnsMonitoringConfig dnsMonitorConfig)
    Parameters
    Type Name Description
    DnsMonitoringConfig dnsMonitorConfig

    Instance of .

    SetTrafficOptimizerConfig(TrafficOptimizerConfig)

    Set the traffic optimizer related configuration.

    Declaration
    void SetTrafficOptimizerConfig(TrafficOptimizerConfig trafficOptimizerConfig)
    Parameters
    Type Name Description
    TrafficOptimizerConfig trafficOptimizerConfig

    Instanace of .

    StopSplitTunnelDriverService(Boolean)

    Stop split tunnel driver service.

    Declaration
    bool StopSplitTunnelDriverService(bool waitForStop)
    Parameters
    Type Name Description
    System.Boolean waitForStop

    Bool parameter to wait till service is stopped.

    Returns
    Type Description
    System.Boolean

    Returns true on success otherwise false.

    UninstallSplitTunnelDriverService(Boolean)

    Uninstall split tunnel driver service.

    Declaration
    bool UninstallSplitTunnelDriverService(bool waitForStop)
    Parameters
    Type Name Description
    System.Boolean waitForStop

    Bool parameter to wait till service is removed.

    Returns
    Type Description
    System.Boolean

    Returns true on success otherwise false.

    UninstallTapDriver()

    Uninstalls the OpenVPN TAP driver.

    Declaration
    Task<DriverUninstallResult> UninstallTapDriver()
    Returns
    Type Description
    Task<DriverUninstallResult>

    Task<DriverUninstallResult>.

    Exceptions
    Type Condition
    NotElevatedException

    Thrown when the running process is not elevated.

    UnsupportedProtocolException

    Thrown when OpenVPN protocol is not available.

    UnsupportedProtocolException

    SDK is configured for running user space only. TAP Driver cannot be set up from user space.

    Events

    AuthenticationCredentialsExpired

    Fires when a users authentication credentials have expired.

    Declaration
    event SDKEventHandler AuthenticationCredentialsExpired
    Event Type
    Type Description
    SDKEventHandler

    AuthenticationStatusChanged

    Fires when the authentication status of the active SDK user changes.

    Declaration
    event SDKEventHandler<AuthenticationStatus> AuthenticationStatusChanged
    Event Type
    Type Description
    SDKEventHandler<AuthenticationStatus>

    BeforeConnectionStateFiltersApplied

    Occurs when the SDK connection state changes and before the network filters are applied.

    Declaration
    event SDKEventHandler<ConnectionStatus> BeforeConnectionStateFiltersApplied
    Event Type
    Type Description
    SDKEventHandler<ConnectionStatus>

    DataTransferUpdate

    Occurs for every second when VPN is connected and data transfer information of VPN adapter is available

    Declaration
    event SDKEventHandler<DataTransferEventArgs> DataTransferUpdate
    Event Type
    Type Description
    SDKEventHandler<DataTransferEventArgs>

    DnsMonitoringUpdate

    Raised when DNS request has been made.

    Declaration
    event Action<DnsMonitoringArgs> DnsMonitoringUpdate
    Event Type
    Type Description
    Action<DnsMonitoringArgs>

    ErrorRaised

    Fires when an error happens on VPN connection or during REST API request.

    Declaration
    event SDKEventHandler<ISDKError> ErrorRaised
    Event Type
    Type Description
    SDKEventHandler<ISDKError>

    LocationsRefreshStatusChanged

    Occurs whenever the servers are being refreshed.

    Declaration
    event SDKEventHandler<RefreshLocationListStatus> LocationsRefreshStatusChanged
    Event Type
    Type Description
    SDKEventHandler<RefreshLocationListStatus>

    TapDeviceInstallationStatusChanged

    Occurs when the TAP device installation status changed.

    Declaration
    event SDKOperationEventHandler TapDeviceInstallationStatusChanged
    Event Type
    Type Description
    SDKOperationEventHandler

    TokensRefreshed

    Raised when tokens are refreshed

    Declaration
    event EventHandler<IUser> TokensRefreshed
    Event Type
    Type Description
    EventHandler<IUser>

    UserLocationStatusChanged

    User location changed event.

    Declaration
    event SDKOperationEventHandler<NetworkGeolocation> UserLocationStatusChanged
    Event Type
    Type Description
    SDKOperationEventHandler<NetworkGeolocation>

    VpnConnectionStatusChanged

    Fires when the active VPN connection status changes. Provides what the status was previously and what it is now.

    Declaration
    event SDKChangeEventHandler<ConnectionStatus> VpnConnectionStatusChanged
    Event Type
    Type Description
    SDKChangeEventHandler<ConnectionStatus>
    Remarks

    When using this event, make sure to check if the before was Connected and the after is Disconnected. If this is the case, the VPN connection was unexpectedly disconnected for an unknown reason. Ensure to notify the user that this happened or automatically reconnect for them depending on your use case.

    In This Article
    Back to top VpnSDK v2 Documentation - © 2023 WLVPN