Model: Endpoint.hasHostAsIPAddress()

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-11-06 23:36:48 +05:30
parent e992030569
commit aa0b6e0c60
1 changed files with 13 additions and 0 deletions

View File

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