aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-04-08 15:18:26 +0530
committerRoopesh Chander <roop@roopc.net>2019-04-09 11:25:04 +0530
commit283462dc9b62dea7f5ca4d5b69e9386f22aa93d7 (patch)
tree192af7b5f42ee1cade4482dd198a6c7aeba0bccf
parentwireguard-go-bridge: version bump to new tag (diff)
downloadwireguard-apple-283462dc9b62dea7f5ca4d5b69e9386f22aa93d7.tar.xz
wireguard-apple-283462dc9b62dea7f5ca4d5b69e9386f22aa93d7.zip
Swift 5 migration: Fix switch warnings
We now get a warning when switching over enums from system frameworks even when we handle all public cases because there can be future cases that aren't handled. When such a future case is introduced, we'll get a warning.
-rw-r--r--WireGuard/Shared/Model/Endpoint.swift6
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelStatus.swift4
-rw-r--r--WireGuard/WireGuardNetworkExtension/DNSResolver.swift2
3 files changed, 12 insertions, 0 deletions
diff --git a/WireGuard/Shared/Model/Endpoint.swift b/WireGuard/Shared/Model/Endpoint.swift
index c328649..ac01649 100644
--- a/WireGuard/Shared/Model/Endpoint.swift
+++ b/WireGuard/Shared/Model/Endpoint.swift
@@ -36,6 +36,8 @@ extension Endpoint {
return "\(address):\(port)"
case .ipv6(let address):
return "[\(address)]:\(port)"
+ @unknown default:
+ fatalError()
}
}
@@ -78,6 +80,8 @@ extension Endpoint {
return true
case .ipv6:
return true
+ @unknown default:
+ fatalError()
}
}
@@ -89,6 +93,8 @@ extension Endpoint {
return nil
case .ipv6:
return nil
+ @unknown default:
+ fatalError()
}
}
}
diff --git a/WireGuard/WireGuard/Tunnel/TunnelStatus.swift b/WireGuard/WireGuard/Tunnel/TunnelStatus.swift
index 61c9e27..547aa9f 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelStatus.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelStatus.swift
@@ -27,6 +27,8 @@ import NetworkExtension
self = .reasserting
case .invalid:
self = .inactive
+ @unknown default:
+ fatalError()
}
}
}
@@ -54,6 +56,8 @@ extension NEVPNStatus: CustomDebugStringConvertible {
case .disconnecting: return "disconnecting"
case .reasserting: return "reasserting"
case .invalid: return "invalid"
+ @unknown default:
+ fatalError()
}
}
}
diff --git a/WireGuard/WireGuardNetworkExtension/DNSResolver.swift b/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
index 16b7909..cdb9665 100644
--- a/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
+++ b/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
@@ -117,6 +117,8 @@ extension Endpoint {
hostname = "\(address)"
case .ipv6(let address):
hostname = "\(address)"
+ @unknown default:
+ fatalError()
}
var resultPointer = UnsafeMutablePointer<addrinfo>(OpaquePointer(bitPattern: 0))