From af870e2a84a2ef424dd8f4121fd54a435bf4e0b5 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Thu, 1 Nov 2018 23:55:44 +0100 Subject: [PATCH 1/3] Fix migrateJSON declarations and exposure Unit tests could not compile. --- .../Sources/Model/ConnectionService+Migration.swift | 6 +++--- Passepartout/Sources/Model/TransientStore.swift | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Passepartout/Sources/Model/ConnectionService+Migration.swift b/Passepartout/Sources/Model/ConnectionService+Migration.swift index d282953b..63d28932 100644 --- a/Passepartout/Sources/Model/ConnectionService+Migration.swift +++ b/Passepartout/Sources/Model/ConnectionService+Migration.swift @@ -29,7 +29,7 @@ import SwiftyBeaver private let log = SwiftyBeaver.self extension ConnectionService { - static func migrateJSON(at from: URL, to: URL) { + static func migrateJSON(from: URL, to: URL) { do { let newData = try migrateJSON(at: from) // log.verbose(String(data: newData, encoding: .utf8)!) @@ -39,8 +39,8 @@ extension ConnectionService { } } - private static func migrateJSON(at from: URL) throws -> Data { - let data = try Data(contentsOf: from) + static func migrateJSON(at url: URL) throws -> Data { + let data = try Data(contentsOf: url) guard var json = try JSONSerialization.jsonObject(with: data, options: []) as? [String: Any] else { throw ApplicationError.migration } diff --git a/Passepartout/Sources/Model/TransientStore.swift b/Passepartout/Sources/Model/TransientStore.swift index 0b65b692..c855d0d0 100644 --- a/Passepartout/Sources/Model/TransientStore.swift +++ b/Passepartout/Sources/Model/TransientStore.swift @@ -53,7 +53,7 @@ class TransientStore { private init() { let cfg = AppConstants.VPN.baseConfiguration() do { - ConnectionService.migrateJSON(at: TransientStore.serviceURL, to: TransientStore.serviceURL) + ConnectionService.migrateJSON(from: TransientStore.serviceURL, to: TransientStore.serviceURL) let data = try Data(contentsOf: TransientStore.serviceURL) if let content = String(data: data, encoding: .utf8) { From 4870e2233da49f70e01b35723c9480389d6b08f4 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 2 Nov 2018 00:03:31 +0100 Subject: [PATCH 2/3] Fix regexes to warn about compression By not including the potential argument in the pattern: - comp-lzo *always* raises a warning - compress *never* raises a warning --- .../Sources/VPN/TunnelKitProvider+FileConfiguration.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift b/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift index a38bdb55..d54ec564 100644 --- a/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift +++ b/Passepartout/Sources/VPN/TunnelKitProvider+FileConfiguration.swift @@ -53,9 +53,9 @@ extension TunnelKitProvider.Configuration { static let auth = Utils.regex("^auth +[\\w\\-]+") - static let compLZO = Utils.regex("^comp-lzo") + static let compLZO = Utils.regex("^comp-lzo.*") - static let compress = Utils.regex("^compress") + static let compress = Utils.regex("^compress.*") static let ping = Utils.regex("^ping +\\d+") From 6fd4a263407030fb00e2c6d8e8dbb5e17cc2278b Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Fri, 2 Nov 2018 00:05:40 +0100 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71ea42c3..ccc17ffe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 + +- Incorrect compression warnings when importing host configurations. [#20](https://github.com/keeshux/passepartout-ios/pull/20) + ## 1.0 RC1 1194 (2018-11-01) ### Added