From 1410b89f23be6b21dfa4dad0b47c595dac697cea Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Tue, 6 Nov 2018 23:36:48 +0530 Subject: [PATCH] Model: Endpoint.hasHostAsIPAddress() --- WireGuard/WireGuard/Model/Endpoint.swift | 13 +++++++++++++ 1 file changed, 13 insertions(+) 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 + } + } +}