Commit d24f51d6 authored by Jose Blaya's avatar Jose Blaya

Connectivity with DIP regions

parent 453b3cad
......@@ -235,7 +235,7 @@ class PIAWebServices: WebServices, ConfigurationAccess {
for dipServer in dedicatedIps {
if dipServer.status == DedicatedIPInformationResponse.Status.active {
guard let firstServer = Client.providers.serverProvider.currentServers.first(where: {$0.country == dipServer.id}) else {
guard let firstServer = Client.providers.serverProvider.currentServers.first(where: {$0.identifier == dipServer.id}) else {
callback?([], ClientError.malformedResponseData)
return
}
......
......@@ -239,8 +239,14 @@ public class PIATunnelProfile: NetworkExtensionProfile {
var customCfg = configuration.customConfiguration
if let piaCfg = customCfg as? OpenVPNTunnelProvider.Configuration {
var builder = piaCfg.builder()
if let bestAddress = configuration.server.bestAddressForOpenVPNUDP()?.hostname { // XXX: UDP address = TCP address
builder.resolvedAddresses = [bestAddress]
if let protocols = builder.sessionConfiguration.endpointProtocols, protocols.contains(where: {$0.socketType == .tcp }) {
if let bestAddress = configuration.server.openVPNAddressesForTCP?.first?.ip {
builder.resolvedAddresses = [bestAddress]
}
} else {
if let bestAddress = configuration.server.openVPNAddressesForUDP?.first?.ip {
builder.resolvedAddresses = [bestAddress]
}
}
customCfg = builder.build()
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment