diff options
author | Roopesh Chander <roop@roopc.net> | 2018-11-06 23:36:48 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-11-06 23:59:48 +0530 |
commit | aa0b6e0c60041c98e3085d689f0c0224bb55f7a8 (patch) | |
tree | b8fa5af602049c1476e65a2edab96264c4ca8528 /WireGuard | |
parent | PacketTunnelProvider: modernize header (diff) | |
download | wireguard-apple-aa0b6e0c60041c98e3085d689f0c0224bb55f7a8.tar.xz wireguard-apple-aa0b6e0c60041c98e3085d689f0c0224bb55f7a8.zip |
Model: Endpoint.hasHostAsIPAddress()
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard')
-rw-r--r-- | WireGuard/WireGuard/Model/Endpoint.swift | 13 |
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 + } + } +} |