aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-06 23:36:48 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-06 23:59:48 +0530
commitaa0b6e0c60041c98e3085d689f0c0224bb55f7a8 (patch)
treeb8fa5af602049c1476e65a2edab96264c4ca8528 /WireGuard/WireGuard
parentPacketTunnelProvider: modernize header (diff)
downloadwireguard-apple-aa0b6e0c60041c98e3085d689f0c0224bb55f7a8.tar.xz
wireguard-apple-aa0b6e0c60041c98e3085d689f0c0224bb55f7a8.zip
Model: Endpoint.hasHostAsIPAddress()
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r--WireGuard/WireGuard/Model/Endpoint.swift13
1 files changed, 13 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/Model/Endpoint.swift b/WireGuard/WireGuard/Model/Endpoint.swift
index 483615b..a46d6b7 100644
--- a/WireGuard/WireGuard/Model/Endpoint.swift
+++ b/WireGuard/WireGuard/Model/Endpoint.swift
@@ -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
+ }
+ }
+}