Manage Connection
Provides the essentials to allow your users to connect and disconnect from a server and view their connection status.
Last updated
Provides the essentials to allow your users to connect and disconnect from a server and view their connection status.
Last updated
The VPN SDK provides a set of APIs to allow your users to establish and teardown a VPN connection with a server.
A connection to a server is established by calling the connect to server API using a server selected from the list servers API call.
In order to establish a connection, a SudoVPNServer is required.
Connection configuration is decided at the time of calling the connect API. It is up to you to build up a SudoVPNConfiguration
object.
Property | Description |
---|---|
When the disconnect API is called, the configured server will be set back to undefined.
Both server
and protocolType
can be left as undefined. In the case that server
is left undefined, the best server will be attempted to connect to, using the user's current geographical location. If protocolType
is left undefined, the default protocol (IPSec (IKEv2)
on mobile) will be used.
When connecting to a VPN, a couple of different Protocol types are available. Depending on the platform, only a subset of these types may be supported.
In a scenario where network is lost whilst connected to an IPSec (IKEv2) or UDP protocol, the VPN tunnel will remain open. This allows the connection to stay open if there are changes in the network (i.e. moving from Wi-Fi to Mobile Data).
Protocol | Description | iOS | Android |
---|---|---|---|
In order to see which protocols are currently available via the client, use the supportedProtocols()
method. This method returns the list of supported protocols mentioned above currently available to the device calling the method.
An example implementation is:
To connect to the VPN, use the connect(withConfiguration:completion:)
method. The completion
will be called either when the connection process has successfully begun, or an error occurred while attempting to do so.
If configuration
is nil
, the best server, and default protocol type will be used.
An example implementation of calling the connect method is:
To watch for connection state events to see when the client has successfully connected (or failed to connect), see Connection Events.
Once already connected, a user may want to deliberately disconnect, or close the connection as part of a process.
To disconnect from an already established connection, use the disconnect(completion:)
method.
An example implementation of calling the disconnect method is:
To watch for connection state events to see when the client has successfully disconnected (or failed to disconnect), see Connection Events.
server
The SudoVPNServer that the client will/is connected to.
protocolType
The SudoVPNProtocol that the client will/is using to connect to the VPN.
L2TP
PPTP
IPSec
IPSec (IKEv2)
OpenVPN UDP
OpenVPN TCP
WireGuard