aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/VPN
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-10-29 23:38:34 +0530
committerRoopesh Chander <roop@roopc.net>2018-10-29 23:38:40 +0530
commit4cacf550a3416046ff3f6b2b2e5d41b4b3c332b4 (patch)
treeb5da8e98a0fc140686373585900b462f73d43a52 /WireGuard/WireGuard/VPN
parentExport: Exporting config files (diff)
downloadwireguard-apple-4cacf550a3416046ff3f6b2b2e5d41b4b3c332b4.tar.xz
wireguard-apple-4cacf550a3416046ff3f6b2b2e5d41b4b3c332b4.zip
VPN: Specify an error when there are no peers with an endpoint
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/VPN')
-rw-r--r--WireGuard/WireGuard/VPN/TunnelsManager.swift5
1 files changed, 5 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/VPN/TunnelsManager.swift b/WireGuard/WireGuard/VPN/TunnelsManager.swift
index 1210d7e..6559382 100644
--- a/WireGuard/WireGuard/VPN/TunnelsManager.swift
+++ b/WireGuard/WireGuard/VPN/TunnelsManager.swift
@@ -13,6 +13,7 @@ protocol TunnelsManagerDelegate: class {
}
enum TunnelsManagerError: Error {
+ case noEndpoint
case dnsResolutionFailed
case tunnelOperationFailed
case attemptingActivationWhenAnotherTunnelIsActive
@@ -262,6 +263,10 @@ class TunnelContainer: NSObject {
let dnsResolver = DNSResolver(endpoints: endpoints)
assert(self.dnsResolver == nil)
if let endpoints = dnsResolver.resolveWithoutNetworkRequests() {
+ guard (endpoints.contains(where: { $0 != nil })) else {
+ completionHandler(TunnelsManagerError.noEndpoint)
+ return
+ }
self.tunnelProvider.loadFromPreferences { [weak self] (error) in
guard let s = self else { return }
s.startObservingTunnelStatus()