Optimal Location
Overview
The optimal location feature allows the VPN SDK to automatically select the best VPN server for your connection. This is ideal when you want to prioritize performance and let the system handle the routing decisions.
Sample Code
Here is how to set optimal location when initializing the SDK and starting the VPN:
Then, retrieve information about the connected server:
Use
optimalNode
to get optimal location node.Call the
GetConnectedServerInfoAsync()
method to retrieve information about the server selected by the optimal location feature.Check the Result property of the
ServerResponse
to determine if the call was successful.Access the Country and Name properties of the
ServerResponse
to get details about the selected server.
Optimal Location vs. Virtual Locations
It is important to note that Optimal location and Virtual locations are two separate features that can be configured independently. They offer flexibility in managing VPN connections but serve different purposes.
Optimal location is a feature that automatically selects VPN nodes based on predefined rules. These rules are designed to provide the best possible connection based on factors such as geographic proximity, server load, and network performance. In some cases, users may not have control over the predefined logic used by the Optimal location feature.
Virtual locations, on the other hand, refer to a list of locations that are made available to users. This list may not necessarily include all the VPN nodes that are available through the Optimal location feature. Virtual locations allow users to manually select specific locations from the provided list.
Optimal location and Virtual locations are two powerful features in VPN configuration that provide flexibility and control over how users connect to VPN nodes. While Optimal location automatically selects the best node based on predefined rules, Virtual locations allow users to manually choose from a specific list of locations.
Example Scenario
To better understand the difference between Optimal location and Virtual locations, consider the following example:
Suppose a VPN service provider wants to configure their system so that all users in the United States are automatically connected to VPN nodes located in the closest major cities with available data centers. These cities might include San Francisco, Boston, New York, Seattle, and others. This is where the Optimal location feature comes into play, automatically selecting the best node based on the user's location.
In addition to the Optimal location feature, the service provider wants to give each user the option to manually select from two specific Virtual locations: New York and Boston. In this case, the Virtual locations list will only contain these two locations, even though the Optimal location feature might connect users to nodes in other cities.
It's important to note that the Optimal location feature might return nodes that belong to a location not included in the Virtual locations list.
Last updated
Was this helpful?