Merge branch 'clean-up-rc'

This commit is contained in:
Davide De Rosa 2018-11-01 13:44:19 +01:00
commit 3f4d38c392
5 changed files with 26 additions and 245 deletions

View File

@ -7,98 +7,46 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Unreleased
### Changed
- Add current Wi-Fi to trusted networks list but don't trust it by default.
## 1.0 beta 1159 (2018-10-27)
### Fixed
- Handling of extra whitespaces in .ovpn (Mike Mayer). [#17](https://github.com/keeshux/passepartout-ios/issues/17)
- Glitches in import wizard flow, sometimes not even appearing.
## 1.0 beta 1150 (2018-10-27)
### Added
- Attach .ovpn when reporting a connectivity issue, stripped of sensitive data. [#13](https://github.com/keeshux/passepartout-ios/pull/13)
- iTunes File Sharing (skythedesu). [#14](https://github.com/keeshux/passepartout-ios/pull/14)
### Fixed
- Warn about .ovpn containing potentially unsupported compression. [#16](https://github.com/keeshux/passepartout-ios/issues/16)
- Retain credentials of replaced host profile.
## 1.0 beta 1107 (2018-10-26)
### Changed
- Host parameters are read-only if there isn't an original configuration to revert to.
- Overall serialization performance.
WARNING: this build *should not* but *might* erase all your profiles!
## 1.0 beta 1084 (2018-10-24)
### Fixed
- Original configuration not saved after reset.
- Connection occasionally turning inactive after a while.
- Improved performance and privacy of debug log.
## 1.0 beta 1075 (2018-10-23)
### Added
- Tunnel failure reporting in UI. [#8](https://github.com/keeshux/passepartout-ios/pull/8)
- Explicit "Reconnect" button. [#9](https://github.com/keeshux/passepartout-ios/pull/9)
- Option to revert host parameters to original configuration (Nicholas Caito). [#10](https://github.com/keeshux/passepartout-ios/pull/10)
- Support for TLS wrapping (tls-auth and tls-crypt). [#5](https://github.com/keeshux/passepartout-ios/pull/5)
- AES-GCM and new endpoints to PIA network preset. [tunnelkit#32](https://github.com/keeshux/tunnelkit/pull/32)
- Disclosure indicators in profile organizer (Samuel Michaels).
- Disclaimer for app usage.
### Removed
- Password confirmation field, redundant with authentication failure message.
### Fixed
- .ovpn files could not be imported without OpenVPN Connect installed. [#6](https://github.com/keeshux/passepartout-ios/issues/6)
## 1.0 beta 1040 (2018-10-19)
### Added
- Support for TLS wrapping (tls-auth and tls-crypt). [#5](https://github.com/keeshux/passepartout-ios/pull/5)
### Fixed
- Fixed Mullvad abrupt disconnection. [tunnelkit#30](https://github.com/keeshux/tunnelkit/issues/30)
- Credentials are now optional for host profiles. [#4](https://github.com/keeshux/passepartout-ios/pull/4)
## 1.0 beta 1018 (2018-10-18)
### Changed
- Host parameters are read-only if there isn't an original configuration to revert to.
- Overall serialization performance.
- Drive generic support requests on Reddit.
## 1.0 beta 1013 (2018-10-18)
### Added
- AES-GCM and new endpoints to PIA network preset. [tunnelkit#32](https://github.com/keeshux/tunnelkit/pull/32)
- Disclosure indicators in profile organizer (Samuel Michaels).
- Disclaimer for app usage.
- Add current Wi-Fi to trusted networks list but don't trust it by default.
### Fixed
- Handling of extra whitespaces in .ovpn (Mike Mayer). [#17](https://github.com/keeshux/passepartout-ios/issues/17)
- Glitches in import wizard flow, sometimes not even appearing.
- Warn about .ovpn containing potentially unsupported compression. [#16](https://github.com/keeshux/passepartout-ios/issues/16)
- Retain credentials of replaced host profile.
- Original configuration not saved after reset.
- Connection occasionally turning inactive after a while.
- Improved performance and privacy of debug log.
- .ovpn files could not be imported without OpenVPN Connect installed. [#6](https://github.com/keeshux/passepartout-ios/issues/6)
- Fixed Mullvad abrupt disconnection. [tunnelkit#30](https://github.com/keeshux/tunnelkit/issues/30)
- Credentials are now optional for host profiles. [#4](https://github.com/keeshux/passepartout-ios/pull/4)
- Can now import .ovpn files from Apple Files app. [#1](https://github.com/keeshux/passepartout-ios/pull/1)
- Reject unrecognized values for `cipher`, `auth` and `proto`. [#1](https://github.com/keeshux/passepartout-ios/pull/1)
## 1.0 beta 989 (2018-10-16)
### Fixed
- Alert unsupported configuration options.
- Use accent color for checkmarks in table cells.
- Hosts gone while connected. [#19](https://github.com/keeshux/passepartout-ios/issues/19)
## 1.0 beta 975 (2018-10-11)

View File

@ -39,173 +39,15 @@ extension ConnectionService {
}
}
static func migrateJSON(at from: URL) throws -> Data {
private static func migrateJSON(at from: URL) throws -> Data {
let data = try Data(contentsOf: from)
guard var json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else {
throw ApplicationError.migration
}
// put migration logic here
// TODO: remove this code after 1.0 release
let build = json["build"] as? Int ?? 0
if build <= 1084 {
try migrateToWrappedSessionConfiguration(&json)
try migrateToBaseConfiguration(&json)
try migrateToBuildNumber(&json)
try migrateHostProfileConfigurations()
try migrateSplitProfileSerialization(&json)
}
if build <= 1107 {
let fm = FileManager.default
let inbox = fm.userURL(for: .documentDirectory, appending: "Inbox")
try? fm.removeItem(at: inbox)
}
let _ = json["build"] as? Int ?? 0
return try JSONSerialization.data(withJSONObject: json, options: [])
}
// MARK: Atomic migrations
static func migrateToWrappedSessionConfiguration(_ json: inout [String: Any]) throws {
guard let profiles = json["profiles"] as? [[String: Any]] else {
// migrated
return
}
var newProfiles: [[String: Any]] = []
for var container in profiles {
guard var hostProfile = container["host"] as? [String: Any] else {
newProfiles.append(container)
continue
}
guard var parameters = hostProfile["parameters"] as? [String: Any] else {
throw ApplicationError.migration
}
guard parameters["sessionConfiguration"] == nil else {
newProfiles.append(container)
continue
}
migrateSessionConfiguration(in: &parameters)
hostProfile["parameters"] = parameters
container["host"] = hostProfile
newProfiles.append(container)
}
json["profiles"] = newProfiles
}
static func migrateToBaseConfiguration(_ json: inout [String: Any]) throws {
guard var baseConfiguration = json["tunnelConfiguration"] as? [String: Any] else {
// migrated
return
}
migrateSessionConfiguration(in: &baseConfiguration)
json["baseConfiguration"] = baseConfiguration
json.removeValue(forKey: "tunnelConfiguration")
}
static func migrateToBuildNumber(_ json: inout [String: Any]) throws {
json["build"] = GroupConstants.App.buildNumber
}
static func migrateHostProfileConfigurations() throws {
let fm = FileManager.default
let oldDirectory = fm.userURL(for: .documentDirectory, appending: "Configurations")
guard fm.fileExists(atPath: oldDirectory.path) else {
return
}
let newDirectory = fm.userURL(for: .documentDirectory, appending: AppConstants.Store.hostsDirectory)
try fm.moveItem(at: oldDirectory, to: newDirectory)
let list = try fm.contentsOfDirectory(at: newDirectory, includingPropertiesForKeys: nil, options: [])
let prefix = "host."
for url in list {
let filename = url.lastPathComponent
guard filename.hasPrefix(prefix) else {
continue
}
let postPrefixIndex = filename.index(filename.startIndex, offsetBy: prefix.count)
let newFilename = String(filename[postPrefixIndex..<filename.endIndex])
var newURL = url
newURL.deleteLastPathComponent()
newURL.appendPathComponent(newFilename)
try fm.moveItem(at: url, to: newURL)
}
}
static func migrateSplitProfileSerialization(_ json: inout [String: Any]) throws {
guard let profiles = json["profiles"] as? [[String: Any]] else {
return
}
let fm = FileManager.default
let providersParentURL = fm.userURL(for: .documentDirectory, appending: AppConstants.Store.providersDirectory)
let hostsParentURL = fm.userURL(for: .documentDirectory, appending: AppConstants.Store.hostsDirectory)
try? fm.createDirectory(at: providersParentURL, withIntermediateDirectories: false, attributes: nil)
try? fm.createDirectory(at: hostsParentURL, withIntermediateDirectories: false, attributes: nil)
for p in profiles {
if var provider = p["provider"] as? [String: Any] {
guard let id = provider["name"] as? String else {
continue
}
// provider["id"] = id
// provider.removeValue(forKey: "name")
let url = providersParentURL.appendingPathComponent(id).appendingPathExtension("json")
let data = try JSONSerialization.data(withJSONObject: provider, options: [])
try data.write(to: url)
} else if var host = p["host"] as? [String: Any] {
guard let id = host["title"] as? String else {
continue
}
// host["id"] = id
// host.removeValue(forKey: "title")
let url = hostsParentURL.appendingPathComponent(id).appendingPathExtension("json")
let data = try JSONSerialization.data(withJSONObject: host, options: [])
try data.write(to: url)
}
}
guard let activeProfileId = json["activeProfileId"] else {
return
}
json["activeProfileKey"] = activeProfileId
json.removeValue(forKey: "activeProfileId")
json.removeValue(forKey: "profiles")
}
// MARK: Helpers
private static func migrateSessionConfiguration(in map: inout [String: Any]) {
let scKeys = [
"cipher",
"digest",
"ca",
"clientCertificate",
"clientKey",
"compressionFraming",
"tlsWrap",
// "keepAliveSeconds", // renamed
// "renegotiatesAfterSeconds", // renamed
"usesPIAPatches"
]
var sessionConfiguration: [String: Any] = [:]
for key in scKeys {
guard let value = map[key] else {
continue
}
sessionConfiguration[key] = value
map.removeValue(forKey: key)
}
if let value = map["keepAliveSeconds"] {
sessionConfiguration["keepAliveInterval"] = value
}
if let value = map["renegotiatesAfterSeconds"] {
sessionConfiguration["renegotiatesAfter"] = value
}
map["sessionConfiguration"] = sessionConfiguration
map.removeValue(forKey: "debugLogKey")
map.removeValue(forKey: "lastErrorKey")
}
}

View File

@ -63,7 +63,7 @@ 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.bigEndian)
return DNSResolver.string(fromIPv4: $0)
}
addrs.insert(hostname, at: 0)
return addrs

View File

@ -2,8 +2,8 @@ source 'https://github.com/cocoapods/specs.git'
use_frameworks!
def shared_pods
#pod 'TunnelKit', '~> 1.1.2'
pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '3447128'
pod 'TunnelKit', '~> 1.3.0'
#pod 'TunnelKit', :git => 'https://github.com/keeshux/tunnelkit', :commit => '9c989da'
#pod 'TunnelKit', :path => '../tunnelkit'
end

View File

@ -14,23 +14,14 @@ PODS:
DEPENDENCIES:
- MBProgressHUD
- TunnelKit (from `https://github.com/keeshux/tunnelkit`, commit `3447128`)
- TunnelKit (~> 1.3.0)
SPEC REPOS:
https://github.com/cocoapods/specs.git:
- MBProgressHUD
- OpenSSL-Apple
- SwiftyBeaver
EXTERNAL SOURCES:
TunnelKit:
:commit: '3447128'
:git: https://github.com/keeshux/tunnelkit
CHECKOUT OPTIONS:
TunnelKit:
:commit: '3447128'
:git: https://github.com/keeshux/tunnelkit
- TunnelKit
SPEC CHECKSUMS:
MBProgressHUD: e7baa36a220447d8aeb12769bf0585582f3866d9
@ -38,6 +29,6 @@ SPEC CHECKSUMS:
SwiftyBeaver: ccfcdf85a04d429f1633f668650b0ce8020bda3a
TunnelKit: 8e747cac28959ebfdfa4eeab589c933f1856c0fb
PODFILE CHECKSUM: 2e3ddf964a7da5d6afc6d39c26218d9af992c770
PODFILE CHECKSUM: 6e8d763f62d6de73b2704ad87c725d3116d051df
COCOAPODS: 1.6.0.beta.2