diff --git a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 4097c8af..b631e269 100644 --- a/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/Passepartout.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/passepartoutvpn/openssl-apple", "state": { "branch": null, - "revision": "cbbff97a99384a5415bb47c072c376066b78f65f", - "version": "1.1.11300" + "revision": "1c03f4d3fc1d90a0a525af68f06eada56e5e8bb1", + "version": "1.1.11500" } }, { @@ -51,7 +51,7 @@ "repositoryURL": "https://github.com/passepartoutvpn/tunnelkit", "state": { "branch": null, - "revision": "6e0471a55b8277ff0b21e4dd3dfcfcc8da5f0355", + "revision": "36ed23ccc4e6083d671b6b823f50787b018f2844", "version": null } }, diff --git a/Passepartout/App/Constants/Constants+Extensions.swift b/Passepartout/App/Constants/Constants+Extensions.swift index dcc9f1ae..f6188742 100644 --- a/Passepartout/App/Constants/Constants+Extensions.swift +++ b/Passepartout/App/Constants/Constants+Extensions.swift @@ -157,8 +157,14 @@ extension Constants { .appendingPathComponent(filename) } + private static func containerLogPath(filename: String) -> String { + "\(parentPath)/\(filename)" + } + static let appLogURL = containerLogURL(filename: "App.log") + static let tunnelLogPath = containerLogPath(filename: "Tunnel.log") + static let logLevel: SwiftyBeaver.Level = { guard let levelString = ProcessInfo.processInfo.environment["LOG_LEVEL"], let levelNum = Int(levelString) else { return .info diff --git a/Passepartout/Shared/Contexts/CoreContext.swift b/Passepartout/Shared/Contexts/CoreContext.swift index 19607ee7..600b8d00 100644 --- a/Passepartout/Shared/Contexts/CoreContext.swift +++ b/Passepartout/Shared/Contexts/CoreContext.swift @@ -112,6 +112,7 @@ class CoreContext { private func configureObjects() { providerManager.rateLimitMilliseconds = Constants.RateLimit.providerManager + vpnManager.tunnelLogPath = Constants.Log.tunnelLogPath vpnManager.tunnelLogFormat = Constants.Log.tunnelLogFormat profileManager.observeUpdates() diff --git a/PassepartoutCore/Package.swift b/PassepartoutCore/Package.swift index ec5430f4..3f042a31 100644 --- a/PassepartoutCore/Package.swift +++ b/PassepartoutCore/Package.swift @@ -24,7 +24,7 @@ let package = Package( // Dependencies declare other packages that this package depends on. // .package(url: /* package url */, from: "1.0.0"), // .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", from: "4.1.0"), - .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", .revision("6e0471a55b8277ff0b21e4dd3dfcfcc8da5f0355")), + .package(name: "TunnelKit", url: "https://github.com/passepartoutvpn/tunnelkit", .revision("36ed23ccc4e6083d671b6b823f50787b018f2844")), // .package(name: "TunnelKit", path: "../../tunnelkit"), .package(url: "https://github.com/zoul/generic-json-swift", from: "2.0.0"), .package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver", from: "1.9.0") diff --git a/PassepartoutCore/Sources/PassepartoutCore/Extensions/OpenVPNSettings+VPNConfiguration.swift b/PassepartoutCore/Sources/PassepartoutCore/Extensions/OpenVPNSettings+VPNConfiguration.swift index 8801169b..52daaebd 100644 --- a/PassepartoutCore/Sources/PassepartoutCore/Extensions/OpenVPNSettings+VPNConfiguration.swift +++ b/PassepartoutCore/Sources/PassepartoutCore/Extensions/OpenVPNSettings+VPNConfiguration.swift @@ -56,6 +56,7 @@ extension Profile.OpenVPNSettings: VPNConfigurationProviding { configuration: customConfiguration ) cfg.shouldDebug = true + cfg.debugLogPath = parameters.preferences.tunnelLogPath cfg.debugLogFormat = parameters.preferences.tunnelLogFormat cfg.masksPrivateData = parameters.preferences.masksPrivateData cfg.username = parameters.username diff --git a/PassepartoutCore/Sources/PassepartoutCore/Extensions/WireGuardSettings+VPNConfiguration.swift b/PassepartoutCore/Sources/PassepartoutCore/Extensions/WireGuardSettings+VPNConfiguration.swift index a576de5d..cc95128f 100644 --- a/PassepartoutCore/Sources/PassepartoutCore/Extensions/WireGuardSettings+VPNConfiguration.swift +++ b/PassepartoutCore/Sources/PassepartoutCore/Extensions/WireGuardSettings+VPNConfiguration.swift @@ -47,6 +47,7 @@ extension Profile.WireGuardSettings: VPNConfigurationProviding { configuration: customConfiguration ) cfg.shouldDebug = true + cfg.debugLogPath = parameters.preferences.tunnelLogPath cfg.debugLogFormat = parameters.preferences.tunnelLogFormat var extra = NetworkExtensionExtra() diff --git a/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManager+Configuration.swift b/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManager+Configuration.swift index e0921ab2..ea5cc2ca 100644 --- a/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManager+Configuration.swift +++ b/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManager+Configuration.swift @@ -28,6 +28,7 @@ import Foundation extension VPNManager { private var vpnPreferences: VPNPreferences { DefaultVPNPreferences( + tunnelLogPath: tunnelLogPath, tunnelLogFormat: tunnelLogFormat, masksPrivateData: masksPrivateData ) diff --git a/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManager.swift b/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManager.swift index 69594fd3..f102e35b 100644 --- a/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManager.swift +++ b/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManager.swift @@ -259,6 +259,15 @@ extension VPNManager { // MARK: KeyValueStore extension VPNManager { + public var tunnelLogPath: String? { + get { + store.value(forLocation: StoreKey.tunnelLogPath) + } + set { + store.setValue(newValue, forLocation: StoreKey.tunnelLogPath) + } + } + public var tunnelLogFormat: String? { get { store.value(forLocation: StoreKey.tunnelLogFormat) @@ -282,6 +291,8 @@ extension VPNManager { private extension VPNManager { private enum StoreKey: String, KeyStoreDomainLocation { + case tunnelLogPath + case tunnelLogFormat case masksPrivateData diff --git a/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManagerStrategy+TunnelKit.swift b/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManagerStrategy+TunnelKit.swift index dc7998cc..3e6c8314 100644 --- a/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManagerStrategy+TunnelKit.swift +++ b/PassepartoutCore/Sources/PassepartoutCore/Managers/VPNManagerStrategy+TunnelKit.swift @@ -281,10 +281,10 @@ extension VPNManager { public func debugLogURL(forProtocol vpnProtocol: VPNProtocolType) -> URL? { switch vpnProtocol { case .openVPN: - return FileManager.default.openVPNURLForDebugLog(appGroup: appGroup) + return defaults.openVPNURLForDebugLog(appGroup: appGroup) default: - return FileManager.default.wireGuardURLForDebugLog(appGroup: appGroup) + return defaults.wireGuardURLForDebugLog(appGroup: appGroup) } } diff --git a/PassepartoutCore/Sources/PassepartoutCore/Models/VPNPreferences.swift b/PassepartoutCore/Sources/PassepartoutCore/Models/VPNPreferences.swift index 90a7ee0e..1d333ed4 100644 --- a/PassepartoutCore/Sources/PassepartoutCore/Models/VPNPreferences.swift +++ b/PassepartoutCore/Sources/PassepartoutCore/Models/VPNPreferences.swift @@ -26,12 +26,16 @@ import Foundation public protocol VPNPreferences { + var tunnelLogPath: String? { get } + var tunnelLogFormat: String? { get } var masksPrivateData: Bool { get } } struct DefaultVPNPreferences: VPNPreferences { + let tunnelLogPath: String? + let tunnelLogFormat: String? let masksPrivateData: Bool