Fetching a list of available locations
Locations represent a cluster of servers at a specific geographical location. The SDK will use proper caching so that this list is frequently updated.
get_locations_for_protocols
Fetch list of locations with an HTTP call or from local HTTP cache, small response payload size. This will return all available locations for the provided subscription id and protocols. A shortcut to this method is get_locations() which will set the protocols to lightway, openvpn and wireguard.
Parameters
| Name | Description |
|---|---|
| subscription_id | ID of the subscription which has a VPN entitlement. You can obtain that subscription id as described in Obtaining a VPN Subscription ID |
| protocols | An array of protocol identifiers. lightwayopenvpnwireguardproxy |
Returns
Array of ServerLocation objects if successful, InstanceDiscoveryException otherwise.
get_full_locations_for_protocols
Fetch full dataset of all locations and endpoints, around 3MB JSON payload compressed to around 300kb over the wire, or read from local cache. The method returns all available locations for the provided subscription id and protocols.
The set of protocols must be full list of protocols supported by current client.
Parameters
| Name | Description |
|---|---|
| subscription_id | ID of the subscription which has a VPN entitlement. You can obtain that subscription id as described in Obtaining a VPN Subscription ID |
| protocols | An array of all protocol identifiers supported by current client. lightwayopenvpnwireguardproxy |
ServerLocation
| Name | Description |
|---|---|
| id | Unique ID of that location |
| name | Display Name of that location |
| latitude | Geographical Latitude of that location |
| longitude | Geographical Longitude of that location |
| country_code | ISO3166-1 alpha2 Country Code |
| instance_count_min | Minimum number of instances in that location |
| instance_count_max | Maximum number of instances in that location |
| is_geolocated | If true, this instance is physically not located in that location, but emulates the location by using a specific set of IPs, which are associated with that location |
| popularity_order | If set, it defines the popularity of that location, which can be used to show popular locations in the UI of the app |
| test_ips | A set of IPs, which this instance provided to run speedtests |