Handle Pool.resolved to use external hostname

This commit is contained in:
Davide De Rosa 2019-04-26 10:13:39 +02:00
parent c1d8233339
commit b61906c32f
2 changed files with 5 additions and 1 deletions

View File

@ -176,7 +176,7 @@ public extension ProviderConnectionProfile {
var addresses: [String] {
var addrs = pool?.addresses() ?? []
if let pool = pool, let externalHostname = try? preset?.externalConfiguration(forKey: .hostname, infrastructureName: infrastructure.name, pool: pool) as? String {
if addrs.isEmpty, let pool = pool, !(pool.isResolved ?? false), let externalHostname = try? preset?.externalConfiguration(forKey: .hostname, infrastructureName: infrastructure.name, pool: pool) as? String {
addrs.insert(externalHostname, at: 0)
}
return addrs

View File

@ -44,6 +44,8 @@ public struct Pool: Codable, Hashable {
case hostname
case isResolved = "resolved"
case numericAddresses = "addrs"
}
@ -62,6 +64,8 @@ public struct Pool: Codable, Hashable {
// public let location: (Double, Double)
public let hostname: String?
public let isResolved: Bool?
public let numericAddresses: [UInt32]?