]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
Model: Endpoint.hasHostAsIPAddress()
authorRoopesh Chander <roop@roopc.net>
Tue, 6 Nov 2018 18:06:48 +0000 (23:36 +0530)
committerRoopesh Chander <roop@roopc.net>
Tue, 6 Nov 2018 18:29:48 +0000 (23:59 +0530)
Signed-off-by: Roopesh Chander <roop@roopc.net>
WireGuard/WireGuard/Model/Endpoint.swift

index 483615b90639789ef6cf95c795bcc9b57743721d..a46d6b763d61cf667e3bfe7dc0874e02fbc8de5d 100644 (file)
@@ -75,3 +75,16 @@ extension Endpoint: Codable {
         case invalidData
     }
 }
+
+extension Endpoint {
+    func hasHostAsIPAddress() -> Bool {
+        switch (host) {
+        case .name(_, _):
+            return false
+        case .ipv4(_):
+            return true
+        case .ipv6(_):
+            return true
+        }
+    }
+}