Merge pull request #31 from passepartoutvpn/drop-ip-sorting
Do not sort endpoint addresses
This commit is contained in:
commit
95a39d5376
|
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Fixed
|
||||
|
||||
- Retain DNS reply order in resolved endpoint addresses. [#31](https://github.com/passepartoutvpn/passepartout-ios/pull/31)
|
||||
|
||||
## 1.0 (2019-01-16)
|
||||
|
||||
### Added
|
||||
|
|
|
@ -125,7 +125,7 @@ class ProviderConnectionProfile: ConnectionProfile, Codable, Equatable {
|
|||
builder.resolvedAddresses = [address]
|
||||
} else {
|
||||
builder.prefersResolvedAddresses = !preferences.resolvesHostname
|
||||
builder.resolvedAddresses = pool.addresses(sorted: false)
|
||||
builder.resolvedAddresses = pool.addresses()
|
||||
}
|
||||
|
||||
if let proto = manualProtocol {
|
||||
|
@ -158,7 +158,7 @@ extension ProviderConnectionProfile {
|
|||
}
|
||||
|
||||
var addresses: [String] {
|
||||
return pool?.addresses(sorted: true) ?? []
|
||||
return pool?.addresses() ?? []
|
||||
}
|
||||
|
||||
var protocols: [EndpointProtocol] {
|
||||
|
|
|
@ -61,10 +61,8 @@ struct Pool: Codable, Comparable, CustomStringConvertible {
|
|||
}
|
||||
|
||||
// XXX: inefficient, can't easily use lazy on struct
|
||||
func addresses(sorted: Bool) -> [String] {
|
||||
var addrs = (sorted ? numericAddresses.sorted() : numericAddresses).map {
|
||||
return DNSResolver.string(fromIPv4: $0)
|
||||
}
|
||||
func addresses() -> [String] {
|
||||
var addrs = numericAddresses.map { DNSResolver.string(fromIPv4: $0) }
|
||||
addrs.insert(hostname, at: 0)
|
||||
return addrs
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue