Model: Endpoint.hostname()

This commit is contained in:
Roopesh Chander 2018-11-08 16:26:17 +05:30
parent e83af4bce5
commit 8f35d70482
1 changed files with 11 additions and 0 deletions

View File

@ -87,4 +87,15 @@ extension Endpoint {
return true
}
}
func hostname() -> String? {
switch (host) {
case .name(let hostname, _):
return hostname
case .ipv4(_):
return nil
case .ipv6(_):
return nil
}
}
}