VPN: Specify an error when there are no peers with an endpoint
This commit is contained in:
parent
22dd3dcc40
commit
0ef0eeb116
|
@ -13,6 +13,7 @@ protocol TunnelsManagerDelegate: class {
|
||||||
}
|
}
|
||||||
|
|
||||||
enum TunnelsManagerError: Error {
|
enum TunnelsManagerError: Error {
|
||||||
|
case noEndpoint
|
||||||
case dnsResolutionFailed
|
case dnsResolutionFailed
|
||||||
case tunnelOperationFailed
|
case tunnelOperationFailed
|
||||||
case attemptingActivationWhenAnotherTunnelIsActive
|
case attemptingActivationWhenAnotherTunnelIsActive
|
||||||
|
@ -262,6 +263,10 @@ class TunnelContainer: NSObject {
|
||||||
let dnsResolver = DNSResolver(endpoints: endpoints)
|
let dnsResolver = DNSResolver(endpoints: endpoints)
|
||||||
assert(self.dnsResolver == nil)
|
assert(self.dnsResolver == nil)
|
||||||
if let endpoints = dnsResolver.resolveWithoutNetworkRequests() {
|
if let endpoints = dnsResolver.resolveWithoutNetworkRequests() {
|
||||||
|
guard (endpoints.contains(where: { $0 != nil })) else {
|
||||||
|
completionHandler(TunnelsManagerError.noEndpoint)
|
||||||
|
return
|
||||||
|
}
|
||||||
self.tunnelProvider.loadFromPreferences { [weak self] (error) in
|
self.tunnelProvider.loadFromPreferences { [weak self] (error) in
|
||||||
guard let s = self else { return }
|
guard let s = self else { return }
|
||||||
s.startObservingTunnelStatus()
|
s.startObservingTunnelStatus()
|
||||||
|
|
Loading…
Reference in New Issue