Manage Servers
Provides your users with the ability to list servers used to establish a connection.
The VPN SDK provides a set of APIs to allow your users to manage the servers they choose to use to establish a VPN connection.
The SudoVPNServer object contains information about the server.
The ISO 3166-1 Alpha-2 code of the country location.
The region within the server country location (e.g. Florida).
Longitude and latitude coordinates of the server location.
Server utilization which ranges from 0-100. 0 is low, whereas 100 is high.
IP Address of the server.

Retrieving Servers

In order to establish a connection using the VPN SDK, a server is required. A list of available servers can be retrieved using the list servers API.
Servers are retrieved by using the method listServers(completion:). The method will either return a list of valid servers to connect to, or an empty list if none are available.
An example implementation is:
vpnClient.listServers { result in
switch result {
case let .failure(cause):
/// Handle/notify user of error
case let .success(servers):
/// `servers` is the retrieved array of `SudoVPNServer` objects,
/// or empty array if no objects are available.
A call to the listServers method provides a list of servers that can be used to establish a connection. An example implementation of retrieving the available servers is:
launch {
try {
val servers = withContext(Dispatchers.IO) {
// If no exception is thrown then the list of [servers] is returned.
} catch (e: SudoVPNException) {
// Handle/notify user of exception
The call to listServers will return the list of available servers. If an exception occurs, the e.localizedMessage can be presented to the user to notify them as to what caused the exception.
Copy link