To enable multihop routing, you need to pass an additional location to the withLocation method of the SessionConfig.Builder class. Both the main location and the proxy location can be fetched using the Backend API.
Here's an example of how to create a SessionConfig with multihop routing:
In this example, "US" is the main location, and "YOUR_ACTUAL_PROXY_LOCATION" is the proxy location.
Fetching Available Virtual Locations
To fetch the available locations for multihop routing, you can use the locations method of the Backend class, specifying the ConnectionType.HYDRA_TCP parameter.
Here's an example of how to fetch the available locations:
UnifiedSdksdk=UnifiedSdk.getInstance();sdk.getBackend().locations(ConnectionType.HYDRA_TCP,newCallback<AvailableLocations>(){@Overridepublicvoid success(@NonNullAvailableLocationsavailableLocations){ // Handle the available locations}@Overridepublicvoid failure(@NonNullVpnExceptione){ // Handle any errors}});
Optimal Proxy
To automatically select the optimal proxy location based on network conditions and server load, you can pass an empty string ("") as the proxy parameter in the withLocation method. Passing null as the proxy parameter means that no proxy location is used.