Do not try to resolve a valid ip address.
This commit is contained in:
parent
0f553856b1
commit
44adfe7a1e
|
@ -49,11 +49,16 @@ struct Endpoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
hostString = hostString.replacingOccurrences(of: "[", with: "").replacingOccurrences(of: "]", with: "")
|
hostString = hostString.replacingOccurrences(of: "[", with: "").replacingOccurrences(of: "]", with: "")
|
||||||
|
var addressType = validateIpAddress(ipToValidate: hostString)
|
||||||
let ipString = convertToipAddress(from: hostString)
|
let ipString: String
|
||||||
|
if addressType == .other {
|
||||||
|
ipString = convertToipAddress(from: hostString)
|
||||||
|
} else {
|
||||||
|
ipString = hostString
|
||||||
|
}
|
||||||
|
|
||||||
ipAddress = String(ipString)
|
ipAddress = String(ipString)
|
||||||
let addressType = validateIpAddress(ipToValidate: ipAddress)
|
addressType = validateIpAddress(ipToValidate: ipAddress)
|
||||||
guard addressType == .IPv4 || addressType == .IPv6 else {
|
guard addressType == .IPv4 || addressType == .IPv6 else {
|
||||||
throw EndpointValidationError.invalidIP(ipAddress)
|
throw EndpointValidationError.invalidIP(ipAddress)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue