Commit 0224769b authored by Jose Blaya's avatar Jose Blaya
Browse files

isProxy parameter

parent 3de3c1bf
......@@ -27,7 +27,7 @@ class PIAAccountClientStateProvider : AccountClientStateProvider {
let validEndpoints = EndpointManager.shared.availableEndpoints()
var clientEndpoints = [AccountEndpoint]()
for endpoint in validEndpoints.reversed() {
clientEndpoints.append(AccountEndpoint(endpoint: endpoint.host, usePinnedCertificate: endpoint.useCertificatePinning ?? false, certificateCommonName: endpoint.commonName))
clientEndpoints.append(AccountEndpoint(endpoint: endpoint.host, isProxy: endpoint.isProxy, usePinnedCertificate: endpoint.useCertificatePinning, certificateCommonName: endpoint.commonName))
}
return clientEndpoints
}
......
......@@ -25,7 +25,7 @@ import PIAAccount
class PIAAccountStagingClientStateProvider : AccountClientStateProvider {
func accountEndpoints() -> [AccountEndpoint] {
return [
AccountEndpoint(endpoint: Client.configuration.baseUrl, usePinnedCertificate: false, certificateCommonName: nil),
AccountEndpoint(endpoint: Client.configuration.baseUrl, isProxy: false, usePinnedCertificate: false, certificateCommonName: nil),
]
}
}
......@@ -28,7 +28,7 @@ class PIARegionClientStateProvider : RegionClientStateProvider {
let validEndpoints = EndpointManager.shared.availableRegionEndpoints()
var clientEndpoints = [RegionEndpoint]()
for endpoint in validEndpoints.reversed() {
clientEndpoints.append(RegionEndpoint(endpoint: endpoint.host, usePinnedCertificate: endpoint.useCertificatePinning ?? false, certificateCommonName: endpoint.commonName))
clientEndpoints.append(RegionEndpoint(endpoint: endpoint.host, isProxy: endpoint.isProxy, usePinnedCertificate: endpoint.useCertificatePinning, certificateCommonName: endpoint.commonName))
}
return clientEndpoints
......
......@@ -23,11 +23,13 @@ import Foundation
public struct PinningEndpoint {
let host: String
let useCertificatePinning: Bool?
let isProxy: Bool
let useCertificatePinning: Bool
let commonName: String?
init(host: String, useCertificatePinning: Bool? = false, commonName: String? = nil) {
init(host: String, isProxy: Bool = false, useCertificatePinning: Bool = false, commonName: String? = nil) {
self.host = host
self.isProxy = isProxy
self.useCertificatePinning = useCertificatePinning
self.commonName = commonName
}
......@@ -95,20 +97,20 @@ public class EndpointManager {
if Client.providers.vpnProvider.isVPNConnected {
return [PinningEndpoint(host: internalUrl),
PinningEndpoint(host: pia),
PinningEndpoint(host: proxy)]
PinningEndpoint(host: proxy, isProxy: true)]
}
var availableEndpoints = [PinningEndpoint]()
availableMetaEndpoints(&availableEndpoints)
availableEndpoints.append(PinningEndpoint(host: pia))
availableEndpoints.append(PinningEndpoint(host: proxy))
availableEndpoints.append(PinningEndpoint(host: proxy, isProxy: true))
return availableEndpoints
} else {
return [PinningEndpoint(host: pia),
PinningEndpoint(host: proxy)]
PinningEndpoint(host: proxy, isProxy: true)]
}
}
......
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