From 36972e43a84a3765a7ed6a4fc77bd92ad4469332 Mon Sep 17 00:00:00 2001 From: Juraj Hilje Date: Wed, 1 Feb 2023 14:25:56 +0100 Subject: [PATCH 1/3] vendor: update TunnelKit to 4.1.0 and install with SPM --- IVPNClient.xcodeproj/project.pbxproj | 77 +++++++++++-------- IVPNClient/Managers/VPNManager.swift | 5 +- .../NETunnelProviderProtocol+Ext.swift | 11 ++- Podfile | 4 +- Podfile.lock | 25 +----- .../PacketTunnelProvider.swift | 2 +- 6 files changed, 60 insertions(+), 64 deletions(-) diff --git a/IVPNClient.xcodeproj/project.pbxproj b/IVPNClient.xcodeproj/project.pbxproj index b6b7276b8..8d0e68179 100644 --- a/IVPNClient.xcodeproj/project.pbxproj +++ b/IVPNClient.xcodeproj/project.pbxproj @@ -46,9 +46,7 @@ 821F604A240D21E3008072D7 /* ControlPanelViewController+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 821F6049240D21E3008072D7 /* ControlPanelViewController+Ext.swift */; }; 8221377B2227E75E001E1BF5 /* CustomDNSViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8221377A2227E75E001E1BF5 /* CustomDNSViewController.swift */; }; 82234B6721BA7F3500B082DE /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82234B6621BA7F3500B082DE /* Logger.swift */; }; - 82234B6E21BA90E400B082DE /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C69422D1DD20FC200F9A801 /* KeyChain.swift */; }; 8223C53F22326375006C4F14 /* Logger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82234B6621BA7F3500B082DE /* Logger.swift */; }; - 8223C5402232694E006C4F14 /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C69422D1DD20FC200F9A801 /* KeyChain.swift */; }; 8223C54C22E9E93A00CD283D /* Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8223C54B22E9E93A00CD283D /* Session.swift */; }; 8223C54E22EAE93F00CD283D /* SessionManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8223C54D22EAE93F00CD283D /* SessionManager.swift */; }; 8223C54F22EAEC7000CD283D /* Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8223C54B22E9E93A00CD283D /* Session.swift */; }; @@ -133,7 +131,6 @@ 826F7F3023A7A89B00777DB9 /* UserDefaults+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 825A43FC215CCFE70076131F /* UserDefaults+Ext.swift */; }; 826F7F3123A7A8CE00777DB9 /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 821429B622FC2BE90056B8FF /* Result.swift */; }; 826F7F3323A7A90200777DB9 /* UserDefaultsTodayExtension+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 826F7F0B23A79F1500777DB9 /* UserDefaultsTodayExtension+Ext.swift */; }; - 826F7F3423A7A91700777DB9 /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C69422D1DD20FC200F9A801 /* KeyChain.swift */; }; 826F7F3523A7A93200777DB9 /* Session.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8223C54B22E9E93A00CD283D /* Session.swift */; }; 826F7F3623A7A94000777DB9 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C2833781D9D3F060024C553 /* Config.swift */; }; 826F7F3723A7A95000777DB9 /* APIAccessManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 820535272302B9D7007BDD58 /* APIAccessManager.swift */; }; @@ -176,8 +173,12 @@ 8292E1A72174C10700123538 /* Peer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8292E1A62174C10700123538 /* Peer.swift */; }; 8292E1A92174C11600123538 /* Interface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8292E1A82174C11600123538 /* Interface.swift */; }; 8292E1AB2174C12200123538 /* Tunnel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8292E1AA2174C12200123538 /* Tunnel.swift */; }; - 8294BC8C22A10F4100328932 /* TunnelKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8294BC8B22A10F4100328932 /* TunnelKit.framework */; }; - 8294BC8E22A126C900328932 /* TunnelKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8294BC8D22A126C900328932 /* TunnelKit.framework */; }; + 82968A32298A970500077E0A /* TunnelKitOpenVPN in Frameworks */ = {isa = PBXBuildFile; productRef = 82968A31298A970500077E0A /* TunnelKitOpenVPN */; }; + 82968A34298A970500077E0A /* TunnelKitOpenVPNAppExtension in Frameworks */ = {isa = PBXBuildFile; productRef = 82968A33298A970500077E0A /* TunnelKitOpenVPNAppExtension */; }; + 82968A35298A98C300077E0A /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C69422D1DD20FC200F9A801 /* KeyChain.swift */; }; + 82968A36298A98C600077E0A /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C69422D1DD20FC200F9A801 /* KeyChain.swift */; }; + 82968A37298A98C900077E0A /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C69422D1DD20FC200F9A801 /* KeyChain.swift */; }; + 82968A38298A98CD00077E0A /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C69422D1DD20FC200F9A801 /* KeyChain.swift */; }; 82989FDE2188981900F7EBE0 /* AppKeyManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82989FDD2188981900F7EBE0 /* AppKeyManager.swift */; }; 829AA4732267372A00037198 /* Designable+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 829AA4722267372A00037198 /* Designable+Ext.swift */; }; 829D2C8221664D5E004FA2B3 /* NSMutableAttributedString+Ext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 829D2C8121664D5E004FA2B3 /* NSMutableAttributedString+Ext.swift */; }; @@ -319,7 +320,6 @@ 9C50959A20FCF6850048DBF2 /* ProtocolTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C50959920FCF6850048DBF2 /* ProtocolTableViewCell.swift */; }; 9C51340A1DE8398400423551 /* Pinger.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C5134091DE8398400423551 /* Pinger.swift */; }; 9C6942251DD0CBF800F9A801 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9C6942241DD0CBF800F9A801 /* NetworkExtension.framework */; }; - 9C69422E1DD20FC200F9A801 /* KeyChain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C69422D1DD20FC200F9A801 /* KeyChain.swift */; }; 9C6942371DD218A900F9A801 /* AccessDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C6942361DD218A900F9A801 /* AccessDetails.swift */; }; 9C7840B020CD8A8A00335736 /* openvpn-tunnel-provider.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 9C7840A820CD8A8A00335736 /* openvpn-tunnel-provider.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; }; 9CAE14C020FE453E00D4DAC0 /* VPNManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9CAE14BF20FE453E00D4DAC0 /* VPNManager.swift */; }; @@ -739,8 +739,8 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8294BC8C22A10F4100328932 /* TunnelKit.framework in Frameworks */, 9CF7E35A20F7A86E008E0EC5 /* NetworkExtension.framework in Frameworks */, + 82968A34298A970500077E0A /* TunnelKitOpenVPNAppExtension in Frameworks */, 08DDD46C7843193A0C8A9F4D /* Pods_openvpn_tunnel_provider.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -749,10 +749,10 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 8294BC8E22A126C900328932 /* TunnelKit.framework in Frameworks */, 82D598C621A6A5C7000FABDE /* SystemConfiguration.framework in Frameworks */, 9CB2CE311DAF9227007A4D2D /* CoreData.framework in Frameworks */, 9C6942251DD0CBF800F9A801 /* NetworkExtension.framework in Frameworks */, + 82968A32298A970500077E0A /* TunnelKitOpenVPN in Frameworks */, 9CC29DF01E1560990080F799 /* StoreKit.framework in Frameworks */, 824B86DF26D42A4600D0101A /* WireGuardKit in Frameworks */, D661274AA295C4153E1286AB /* Pods_IVPNClient.framework in Frameworks */, @@ -1612,6 +1612,9 @@ dependencies = ( ); name = "openvpn-tunnel-provider"; + packageProductDependencies = ( + 82968A33298A970500077E0A /* TunnelKitOpenVPNAppExtension */, + ); productName = "openvpn-tunnel-provider"; productReference = 9C7840A820CD8A8A00335736 /* openvpn-tunnel-provider.appex */; productType = "com.apple.product-type.app-extension"; @@ -1638,6 +1641,7 @@ name = IVPNClient; packageProductDependencies = ( 824B86DE26D42A4600D0101A /* WireGuardKit */, + 82968A31298A970500077E0A /* TunnelKitOpenVPN */, ); productName = IVPNClient; productReference = 9CDDD5AB1D9D2F9F00D39924 /* IVPNClient.app */; @@ -1753,6 +1757,7 @@ mainGroup = 9CDDD5A21D9D2F9E00D39924; packageReferences = ( 824B86DD26D42A4600D0101A /* XCRemoteSwiftPackageReference "wireguard-apple" */, + 82968A30298A970500077E0A /* XCRemoteSwiftPackageReference "tunnelkit" */, ); productRefGroup = 9CDDD5AC1D9D2F9F00D39924 /* Products */; projectDirPath = ""; @@ -1948,10 +1953,7 @@ "${BUILT_PRODUCTS_DIR}/KeychainAccess/KeychainAccess.framework", "${BUILT_PRODUCTS_DIR}/ReachabilitySwift/Reachability.framework", "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework", - "${BUILT_PRODUCTS_DIR}/SwiftyBeaver/SwiftyBeaver.framework", "${BUILT_PRODUCTS_DIR}/SwiftyStoreKit/SwiftyStoreKit.framework", - "${BUILT_PRODUCTS_DIR}/TunnelKit/TunnelKit.framework", - "${PODS_XCFRAMEWORKS_BUILD_DIR}/OpenSSL-Apple/openssl.framework/openssl", ); name = "[CP] Embed Pods Frameworks"; outputPaths = ( @@ -1961,10 +1963,7 @@ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/KeychainAccess.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Reachability.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyBeaver.framework", "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SwiftyStoreKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/TunnelKit.framework", - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/openssl.framework", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -2024,7 +2023,6 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - 826F7F3423A7A91700777DB9 /* KeyChain.swift in Sources */, 826F7F2323A7A0AB00777DB9 /* ApiManager.swift in Sources */, 826F7F3E23A7AA6300777DB9 /* AddressType.swift in Sources */, 826F7F2D23A7A86D00777DB9 /* ApiRequestDI.swift in Sources */, @@ -2050,6 +2048,7 @@ 826F7F4223A7AAB800777DB9 /* Array+Ext.swift in Sources */, 826F7F3323A7A90200777DB9 /* UserDefaultsTodayExtension+Ext.swift in Sources */, 826F7F3023A7A89B00777DB9 /* UserDefaults+Ext.swift in Sources */, + 82968A38298A98CD00077E0A /* KeyChain.swift in Sources */, 825E836525A4834200938240 /* APIPublicKeyPin.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -2061,7 +2060,6 @@ 82E7169A2181E96F00D6B7C2 /* OpenVPNProtocol.swift in Sources */, 8205352A2302BEA3007BDD58 /* Array+Ext.swift in Sources */, 82E716882181E8E100D6B7C2 /* ProviderConfigurationKeys.swift in Sources */, - 8223C5402232694E006C4F14 /* KeyChain.swift in Sources */, 82F638C5217DA89000410318 /* AddressType.swift in Sources */, 82EEB6DB25F961BC00915837 /* URL+Ext.swift in Sources */, 822919712182EB1C00978BBA /* String+Ext.swift in Sources */, @@ -2088,6 +2086,7 @@ 82CA214429379CEC008BADE8 /* UIDevice+Ext.swift in Sources */, 824B86C926D3D7FB00D0101A /* CIDRAddress.swift in Sources */, 826C56D422FD551900D2B76A /* ServiceStatus.swift in Sources */, + 82968A37298A98C900077E0A /* KeyChain.swift in Sources */, 824B86C726D3D7B600D0101A /* ApiManager.swift in Sources */, 82EEB6CD25F9422900915837 /* DNSProtocolType.swift in Sources */, 820EA86C2322430700E16B2D /* Result.swift in Sources */, @@ -2115,7 +2114,6 @@ buildActionMask = 2147483647; files = ( 823BD9E3231D4C8E002E631D /* ErrorResult.swift in Sources */, - 82234B6E21BA90E400B082DE /* KeyChain.swift in Sources */, 82E7168D2181E8E900D6B7C2 /* WireGuardProtocol.swift in Sources */, 9CF7E37820F7ABE3008E0EC5 /* PacketTunnelProvider.swift in Sources */, 82D90474216C7DAF0032F3BE /* Date+Ext.swift in Sources */, @@ -2126,6 +2124,7 @@ 82E716932181E90500D6B7C2 /* ConnectionSettings.swift in Sources */, 823FFB082338E09900F91A5D /* Capability.swift in Sources */, 826F7F4323A7AAD200777DB9 /* Array+Ext.swift in Sources */, + 82968A36298A98C600077E0A /* KeyChain.swift in Sources */, 82E716812181E8AF00D6B7C2 /* TunnelType.swift in Sources */, 82A208C121BAAC6C00C9AD44 /* Config.swift in Sources */, ); @@ -2284,11 +2283,11 @@ 82A6D74A24A3780B00D6C0E1 /* ConnectToServerPopupView.swift in Sources */, 828772FB221C28E000D5E330 /* FlagImageView.swift in Sources */, 82E7880C22B0DA0D00A98D76 /* NETunnelProviderProtocol+Ext.swift in Sources */, + 82968A35298A98C300077E0A /* KeyChain.swift in Sources */, 82F638C2217DA89000410318 /* AddressType.swift in Sources */, 822920A02480FA3600476FC1 /* ServersSort.swift in Sources */, 826E61482428F8E60064F195 /* AccountViewController.swift in Sources */, 820079F42407D96D00EC2062 /* ConnectionInfoBoxView.swift in Sources */, - 9C69422E1DD20FC200F9A801 /* KeyChain.swift in Sources */, 821429BB22FC36100056B8FF /* ApiRequestDI.swift in Sources */, 82AB0877291A6B9C0084625A /* CustomPort+CoreDataClass.swift in Sources */, 82C1D5BC23FE78570059A915 /* MapScrollView.swift in Sources */, @@ -2515,7 +2514,7 @@ DEVELOPMENT_TEAM = WQXXM75BYN; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "today-extension/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2548,7 +2547,7 @@ DEVELOPMENT_TEAM = WQXXM75BYN; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "today-extension/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2580,7 +2579,7 @@ DEVELOPMENT_TEAM = WQXXM75BYN; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "today-extension/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2617,7 +2616,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "wireguard-tunnel-provider/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2656,7 +2655,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "wireguard-tunnel-provider/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2834,7 +2833,7 @@ "$(PROJECT_DIR)/**", ); INFOPLIST_FILE = "$(SRCROOT)/IVPNClient/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2915,7 +2914,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "openvpn-tunnel-provider/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2951,7 +2950,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "wireguard-tunnel-provider/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2999,7 +2998,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "openvpn-tunnel-provider/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3044,7 +3043,7 @@ ); GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = "openvpn-tunnel-provider/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3197,7 +3196,7 @@ "$(PROJECT_DIR)/**", ); INFOPLIST_FILE = "$(SRCROOT)/IVPNClient/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3236,7 +3235,7 @@ "$(PROJECT_DIR)/**", ); INFOPLIST_FILE = "$(SRCROOT)/IVPNClient/Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3353,6 +3352,14 @@ revision = 23618f994f17d8ad8f2f65d79b4a1e8a0830b334; }; }; + 82968A30298A970500077E0A /* XCRemoteSwiftPackageReference "tunnelkit" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/passepartoutvpn/tunnelkit"; + requirement = { + kind = exactVersion; + version = 4.1.0; + }; + }; /* End XCRemoteSwiftPackageReference section */ /* Begin XCSwiftPackageProductDependency section */ @@ -3366,6 +3373,16 @@ package = 824B86DD26D42A4600D0101A /* XCRemoteSwiftPackageReference "wireguard-apple" */; productName = WireGuardKit; }; + 82968A31298A970500077E0A /* TunnelKitOpenVPN */ = { + isa = XCSwiftPackageProductDependency; + package = 82968A30298A970500077E0A /* XCRemoteSwiftPackageReference "tunnelkit" */; + productName = TunnelKitOpenVPN; + }; + 82968A33298A970500077E0A /* TunnelKitOpenVPNAppExtension */ = { + isa = XCSwiftPackageProductDependency; + package = 82968A30298A970500077E0A /* XCRemoteSwiftPackageReference "tunnelkit" */; + productName = TunnelKitOpenVPNAppExtension; + }; /* End XCSwiftPackageProductDependency section */ /* Begin XCVersionGroup section */ diff --git a/IVPNClient/Managers/VPNManager.swift b/IVPNClient/Managers/VPNManager.swift index 27d490f54..817a13b57 100644 --- a/IVPNClient/Managers/VPNManager.swift +++ b/IVPNClient/Managers/VPNManager.swift @@ -24,7 +24,8 @@ import Foundation import NetworkExtension import UIKit -import TunnelKit +import TunnelKitCore +import TunnelKitOpenVPN class VPNManager { @@ -384,7 +385,7 @@ class VPNManager { } do { - try session.sendProviderMessage(OpenVPNTunnelProvider.Message.requestLog.data) { data in + try session.sendProviderMessage(OpenVPNProvider.Message.requestLog.data) { data in guard let data = data, !data.isEmpty else { completion(nil) return diff --git a/IVPNClient/Utilities/Extensions/NETunnelProviderProtocol+Ext.swift b/IVPNClient/Utilities/Extensions/NETunnelProviderProtocol+Ext.swift index 3379fce6e..71bf0a0ff 100644 --- a/IVPNClient/Utilities/Extensions/NETunnelProviderProtocol+Ext.swift +++ b/IVPNClient/Utilities/Extensions/NETunnelProviderProtocol+Ext.swift @@ -24,8 +24,11 @@ import Foundation import NetworkExtension import Network -import TunnelKit +import TunnelKitCore +import TunnelKitManager +import TunnelKitOpenVPN import WireGuardKit +import KeychainAccess extension NETunnelProviderProtocol { @@ -65,19 +68,19 @@ extension NETunnelProviderProtocol { } } - var builder = OpenVPNTunnelProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build()) + var builder = OpenVPNProvider.ConfigurationBuilder(sessionConfiguration: sessionBuilder.build()) builder.shouldDebug = true builder.debugLogFormat = "$Dyyyy-MM-dd HH:mm:ss$d $L $M" builder.masksPrivateData = true let configuration = builder.build() let keychain = Keychain(group: Config.appGroup) - try? keychain.set(password: credentials.password, for: credentials.username, context: Config.openvpnTunnelProvider) + _ = try? keychain.set(password: credentials.password, for: credentials.username, context: Config.openvpnTunnelProvider) let proto = try! configuration.generatedTunnelProtocol( withBundleIdentifier: Config.openvpnTunnelProvider, appGroup: Config.appGroup, context: Config.openvpnTunnelProvider, - username: credentials.username + credentials: credentials ) proto.disconnectOnSleep = !UserDefaults.shared.keepAlive if #available(iOS 15.1, *) { diff --git a/Podfile b/Podfile index 9300cfd4d..bdb718c9f 100644 --- a/Podfile +++ b/Podfile @@ -1,8 +1,7 @@ -platform :ios, '12.0' +platform :ios, '13.0' use_frameworks! target 'IVPNClient' do - pod 'TunnelKit', '~> 3.5.0' pod 'KeychainAccess', '~> 3.2.0' pod 'SwiftyStoreKit', '~> 0.16.1' pod 'JGProgressHUD', '~> 2.0.3' @@ -13,7 +12,6 @@ target 'IVPNClient' do end target 'openvpn-tunnel-provider' do - pod 'TunnelKit', '~> 3.5.0' pod 'KeychainAccess', '~> 3.2.0' end diff --git a/Podfile.lock b/Podfile.lock index b733376ea..e3eb1d358 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -3,25 +3,9 @@ PODS: - FloatingPanel (1.7.4) - JGProgressHUD (2.0.4) - KeychainAccess (3.2.1) - - OpenSSL-Apple (1.1.1l.11) - ReachabilitySwift (5.0.0) - SnapKit (5.0.1) - - SwiftyBeaver (1.9.5) - SwiftyStoreKit (0.16.1) - - TunnelKit (3.5.0): - - TunnelKit/Protocols/OpenVPN (= 3.5.0) - - TunnelKit/AppExtension (3.5.0): - - SwiftyBeaver - - TunnelKit/Core - - TunnelKit/Core (3.5.0): - - SwiftyBeaver - - TunnelKit/Manager (3.5.0): - - SwiftyBeaver - - TunnelKit/Core - - TunnelKit/Protocols/OpenVPN (3.5.0): - - OpenSSL-Apple (~> 1.1.1l.11) - - TunnelKit/AppExtension - - TunnelKit/Manager DEPENDENCIES: - ActiveLabel (~> 1.1.0) @@ -31,7 +15,6 @@ DEPENDENCIES: - ReachabilitySwift (~> 5.0.0) - SnapKit (~> 5.0.1) - SwiftyStoreKit (~> 0.16.1) - - TunnelKit (~> 3.5.0) SPEC REPOS: trunk: @@ -39,25 +22,19 @@ SPEC REPOS: - FloatingPanel - JGProgressHUD - KeychainAccess - - OpenSSL-Apple - ReachabilitySwift - SnapKit - - SwiftyBeaver - SwiftyStoreKit - - TunnelKit SPEC CHECKSUMS: ActiveLabel: 5e3f4de79a1952d4604b845a0610d4776e4b82b3 FloatingPanel: 3c9d0e30fe350e1613157557769d2ec97f76b96b JGProgressHUD: 62658b14e72cccf179efc7a13bcb54d30b92fc22 KeychainAccess: d5470352939ced6d6f7fb51cb2e67aae51fc294f - OpenSSL-Apple: fb93d9a7ce4529054764ce19bb80947a38aee09b ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825 SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb - SwiftyBeaver: 84069991dd5dca07d7069100985badaca7f0ce82 SwiftyStoreKit: 6b9c08810269f030586dac1fae8e75871a82e84a - TunnelKit: da385bd81f797728f86fcf0f2de2e4c4af415c40 -PODFILE CHECKSUM: 2fb7364c00f6889da4384d1ffc35ed5ac3c93e5a +PODFILE CHECKSUM: 34bdc77c9be7333d62048531045a1936b58d739b COCOAPODS: 1.11.3 diff --git a/openvpn-tunnel-provider/PacketTunnelProvider.swift b/openvpn-tunnel-provider/PacketTunnelProvider.swift index 6ab386626..484d77d95 100644 --- a/openvpn-tunnel-provider/PacketTunnelProvider.swift +++ b/openvpn-tunnel-provider/PacketTunnelProvider.swift @@ -21,6 +21,6 @@ // along with the IVPN iOS app. If not, see . // -import TunnelKit +import TunnelKitOpenVPNAppExtension class PacketTunnelProvider: OpenVPNTunnelProvider {} From 50287e4266f976326d3972afb14612f8505cdda2 Mon Sep 17 00:00:00 2001 From: Juraj Hilje Date: Wed, 1 Feb 2023 14:35:08 +0100 Subject: [PATCH 2/3] ci: update iOS deployment target in UnitTests --- IVPNClient.xcodeproj/project.pbxproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/IVPNClient.xcodeproj/project.pbxproj b/IVPNClient.xcodeproj/project.pbxproj index 8d0e68179..ee05e8d3d 100644 --- a/IVPNClient.xcodeproj/project.pbxproj +++ b/IVPNClient.xcodeproj/project.pbxproj @@ -2455,7 +2455,7 @@ DEVELOPMENT_TEAM = WQXXM75BYN; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = UnitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2484,7 +2484,7 @@ DEVELOPMENT_TEAM = WQXXM75BYN; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = UnitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -2869,7 +2869,7 @@ DEVELOPMENT_TEAM = WQXXM75BYN; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = UnitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", From 7c20f85fcd750e67e2f3ae713784b474b38f2ceb Mon Sep 17 00:00:00 2001 From: Juraj Hilje Date: Wed, 1 Feb 2023 14:56:00 +0100 Subject: [PATCH 3/3] refactor: remove #available(iOS 13.0, *) checks --- .../Scenes/MainScreen/Map/MapMarkerView.swift | 7 +----- .../MainScreen/View/ControlPanelView.swift | 11 +++----- .../Scenes/SecureDNS/View/SecureDNSView.swift | 7 +----- .../CreateAccountViewController.swift | 4 +-- .../Scenes/Signup/LoginViewController.swift | 4 +-- .../Payment/PaymentViewController.swift | 5 +--- .../Scanner/ScannerViewController.swift | 4 +-- .../SelectPlan/SelectPlanViewController.swift | 9 ++----- .../NavigationController.swift | 25 +++++++------------ .../TermsOfServiceViewController.swift | 4 +-- .../UpgradePlanViewController.swift | 4 +-- .../Extensions/UIImageView+Ext.swift | 6 +---- .../Extensions/UIViewController+Ext.swift | 7 +++--- 13 files changed, 26 insertions(+), 71 deletions(-) diff --git a/IVPNClient/Scenes/MainScreen/Map/MapMarkerView.swift b/IVPNClient/Scenes/MainScreen/Map/MapMarkerView.swift index 721111540..dfdda6119 100644 --- a/IVPNClient/Scenes/MainScreen/Map/MapMarkerView.swift +++ b/IVPNClient/Scenes/MainScreen/Map/MapMarkerView.swift @@ -157,12 +157,7 @@ class MapMarkerView: UIView { private func addObservers() { NotificationCenter.default.addObserver(self, selector: #selector(hidePopup), name: Notification.Name.HideConnectionInfoPopup, object: nil) - - if #available(iOS 13.0, *) { - NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive), name: UIScene.didActivateNotification, object: nil) - } else { - NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive), name: UIApplication.didBecomeActiveNotification, object: nil) - } + NotificationCenter.default.addObserver(self, selector: #selector(appDidBecomeActive), name: UIScene.didActivateNotification, object: nil) } // MARK: - Private methods - diff --git a/IVPNClient/Scenes/MainScreen/View/ControlPanelView.swift b/IVPNClient/Scenes/MainScreen/View/ControlPanelView.swift index 1043a4890..e74dcf0a0 100644 --- a/IVPNClient/Scenes/MainScreen/View/ControlPanelView.swift +++ b/IVPNClient/Scenes/MainScreen/View/ControlPanelView.swift @@ -84,11 +84,8 @@ class ControlPanelView: UITableView { // MARK: - Methods - func setupView() { - if #available(iOS 13.0, *) { - connectSwitch.thumbTintColor = UIColor.init(named: Theme.ivpnGray17) - connectSwitch.onTintColor = UIColor.init(named: Theme.ivpnBlue) - } - + connectSwitch.thumbTintColor = UIColor.init(named: Theme.ivpnGray17) + connectSwitch.onTintColor = UIColor.init(named: Theme.ivpnBlue) updateConnectSwitch() UIAccessibility.post(notification: UIAccessibility.Notification.layoutChanged, argument: protectionStatusTableCell) @@ -149,9 +146,7 @@ class ControlPanelView: UITableView { } private func updateConnectSwitch() { - if #available(iOS 13.0, *) { - connectSwitch.subviews[0].subviews[0].backgroundColor = UIColor.init(named: Theme.ivpnRedOff) - } + connectSwitch.subviews[0].subviews[0].backgroundColor = UIColor.init(named: Theme.ivpnRedOff) } } diff --git a/IVPNClient/Scenes/SecureDNS/View/SecureDNSView.swift b/IVPNClient/Scenes/SecureDNS/View/SecureDNSView.swift index e51332af7..576a998b6 100644 --- a/IVPNClient/Scenes/SecureDNS/View/SecureDNSView.swift +++ b/IVPNClient/Scenes/SecureDNS/View/SecureDNSView.swift @@ -74,12 +74,7 @@ class SecureDNSView: UITableView { // MARK: - Observers - private func addObservers() { - if #available(iOS 13.0, *) { - NotificationCenter.default.addObserver(self, selector: #selector(updateEnableSwitch), name: UIScene.didActivateNotification, object: nil) - } else { - NotificationCenter.default.addObserver(self, selector: #selector(updateEnableSwitch), name: UIApplication.didBecomeActiveNotification, object: nil) - } - + NotificationCenter.default.addObserver(self, selector: #selector(updateEnableSwitch), name: UIScene.didActivateNotification, object: nil) NotificationCenter.default.addObserver(self, selector: #selector(updateResolvedDNS), name: Notification.Name.UpdateResolvedDNS, object: nil) } diff --git a/IVPNClient/Scenes/Signup/CreateAccount/CreateAccountViewController.swift b/IVPNClient/Scenes/Signup/CreateAccount/CreateAccountViewController.swift index a81e42668..2539098fa 100644 --- a/IVPNClient/Scenes/Signup/CreateAccount/CreateAccountViewController.swift +++ b/IVPNClient/Scenes/Signup/CreateAccount/CreateAccountViewController.swift @@ -49,9 +49,7 @@ class CreateAccountViewController: UIViewController { // iOS 13 UIKit bug: https://forums.developer.apple.com/thread/121861 // Remove when fixed in future releases - if #available(iOS 13.0, *) { - navigationController?.navigationBar.setNeedsLayout() - } + navigationController?.navigationBar.setNeedsLayout() } } diff --git a/IVPNClient/Scenes/Signup/LoginViewController.swift b/IVPNClient/Scenes/Signup/LoginViewController.swift index 6908803b3..bf846b286 100644 --- a/IVPNClient/Scenes/Signup/LoginViewController.swift +++ b/IVPNClient/Scenes/Signup/LoginViewController.swift @@ -132,9 +132,7 @@ class LoginViewController: UIViewController { // iOS 13 UIKit bug: https://forums.developer.apple.com/thread/121861 // Remove when fixed in future releases - if #available(iOS 13.0, *) { - navigationController?.navigationBar.setNeedsLayout() - } + navigationController?.navigationBar.setNeedsLayout() } // MARK: - Observers - diff --git a/IVPNClient/Scenes/Signup/Payment/PaymentViewController.swift b/IVPNClient/Scenes/Signup/Payment/PaymentViewController.swift index 74dc95462..69b7b9603 100644 --- a/IVPNClient/Scenes/Signup/Payment/PaymentViewController.swift +++ b/IVPNClient/Scenes/Signup/Payment/PaymentViewController.swift @@ -150,10 +150,7 @@ class PaymentViewController: UITableViewController { } private func setupView() { - if #available(iOS 13.0, *) { - isModalInPresentation = true - } - + isModalInPresentation = true view.backgroundColor = UIColor.init(named: Theme.ivpnBackgroundPrimary) payButton?.set(title: "Pay", subtitle: "") diff --git a/IVPNClient/Scenes/Signup/Scanner/ScannerViewController.swift b/IVPNClient/Scenes/Signup/Scanner/ScannerViewController.swift index 131210b9a..7259f601f 100644 --- a/IVPNClient/Scenes/Signup/Scanner/ScannerViewController.swift +++ b/IVPNClient/Scenes/Signup/Scanner/ScannerViewController.swift @@ -54,9 +54,7 @@ class ScannerViewController: UIViewController, AVCaptureMetadataOutputObjectsDel // iOS 13 UIKit bug: https://forums.developer.apple.com/thread/121861 // Remove when fixed in future releases - if #available(iOS 13.0, *) { - navigationController?.navigationBar.setNeedsLayout() - } + navigationController?.navigationBar.setNeedsLayout() evaluateCameraAccess() startCaptureSession() diff --git a/IVPNClient/Scenes/Signup/SelectPlan/SelectPlanViewController.swift b/IVPNClient/Scenes/Signup/SelectPlan/SelectPlanViewController.swift index 1ad3d586e..49576dee5 100644 --- a/IVPNClient/Scenes/Signup/SelectPlan/SelectPlanViewController.swift +++ b/IVPNClient/Scenes/Signup/SelectPlan/SelectPlanViewController.swift @@ -126,9 +126,7 @@ class SelectPlanViewController: UITableViewController { super.viewWillAppear(animated) // iOS 13 UIKit bug: https://forums.developer.apple.com/thread/121861 // Remove when fixed in future releases - if #available(iOS 13.0, *) { - navigationController?.navigationBar.setNeedsLayout() - } + navigationController?.navigationBar.setNeedsLayout() } override func viewDidAppear(_ animated: Bool) { @@ -179,10 +177,7 @@ class SelectPlanViewController: UITableViewController { } private func setupView() { - if #available(iOS 13.0, *) { - isModalInPresentation = true - } - + isModalInPresentation = true tableView.separatorStyle = .none view.addSubview(spinner) view.addSubview(retryButton) diff --git a/IVPNClient/Scenes/ViewControllers/NavigationController.swift b/IVPNClient/Scenes/ViewControllers/NavigationController.swift index ea00af56e..9a5b2e861 100644 --- a/IVPNClient/Scenes/ViewControllers/NavigationController.swift +++ b/IVPNClient/Scenes/ViewControllers/NavigationController.swift @@ -31,22 +31,15 @@ class NavigationController: UINavigationController { UINavigationBar.appearance().tintColor = UIColor.init(named: Theme.ivpnBlue) navigationBar.prefersLargeTitles = true - if #available(iOS 13.0, *) { - let appearance = UINavigationBarAppearance() - appearance.configureWithOpaqueBackground() - appearance.titleTextAttributes = [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 17, weight: .bold), NSAttributedString.Key.foregroundColor: UIColor.init(named: Theme.ivpnLabelPrimary)!] - appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.init(named: Theme.ivpnLabelPrimary)!] - appearance.backgroundColor = UIColor.init(named: Theme.ivpnBackgroundPrimary)! - appearance.shadowImage = nil - appearance.shadowColor = nil - navigationBar.standardAppearance = appearance - navigationBar.scrollEdgeAppearance = appearance - } else { - navigationBar.barTintColor = UIColor.init(named: Theme.ivpnBackgroundPrimary) - navigationBar.titleTextAttributes = [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 17, weight: .bold), NSAttributedString.Key.foregroundColor: UIColor.init(named: Theme.ivpnLabelPrimary)!] - navigationBar.shadowImage = UIImage() - navigationBar.barTintColor = UIColor.init(named: Theme.ivpnBackgroundPrimary)! - } + let appearance = UINavigationBarAppearance() + appearance.configureWithOpaqueBackground() + appearance.titleTextAttributes = [NSAttributedString.Key.font: UIFont.systemFont(ofSize: 17, weight: .bold), NSAttributedString.Key.foregroundColor: UIColor.init(named: Theme.ivpnLabelPrimary)!] + appearance.largeTitleTextAttributes = [.foregroundColor: UIColor.init(named: Theme.ivpnLabelPrimary)!] + appearance.backgroundColor = UIColor.init(named: Theme.ivpnBackgroundPrimary)! + appearance.shadowImage = nil + appearance.shadowColor = nil + navigationBar.standardAppearance = appearance + navigationBar.scrollEdgeAppearance = appearance } override func viewWillAppear(_ animated: Bool) { diff --git a/IVPNClient/Scenes/ViewControllers/TermsOfServiceViewController.swift b/IVPNClient/Scenes/ViewControllers/TermsOfServiceViewController.swift index 3debcc41b..aca96b16e 100644 --- a/IVPNClient/Scenes/ViewControllers/TermsOfServiceViewController.swift +++ b/IVPNClient/Scenes/ViewControllers/TermsOfServiceViewController.swift @@ -63,9 +63,7 @@ class TermsOfServiceViewController: UIViewController { super.viewWillAppear(animated) // iOS 13 UIKit bug: https://forums.developer.apple.com/thread/121861 // Remove when fixed in future releases - if #available(iOS 13.0, *) { - navigationController?.navigationBar.setNeedsLayout() - } + navigationController?.navigationBar.setNeedsLayout() } // MARK: - Methods - diff --git a/IVPNClient/Scenes/ViewControllers/UpgradePlanViewController.swift b/IVPNClient/Scenes/ViewControllers/UpgradePlanViewController.swift index 32e345c62..74a438b03 100644 --- a/IVPNClient/Scenes/ViewControllers/UpgradePlanViewController.swift +++ b/IVPNClient/Scenes/ViewControllers/UpgradePlanViewController.swift @@ -47,9 +47,7 @@ class UpgradePlanViewController: UIViewController { // iOS 13 UIKit bug: https://forums.developer.apple.com/thread/121861 // Remove when fixed in future releases - if #available(iOS 13.0, *) { - navigationController?.navigationBar.setNeedsLayout() - } + navigationController?.navigationBar.setNeedsLayout() } // MARK: - @IBActions - diff --git a/IVPNClient/Utilities/Extensions/UIImageView+Ext.swift b/IVPNClient/Utilities/Extensions/UIImageView+Ext.swift index 470f30d12..165e334a8 100644 --- a/IVPNClient/Utilities/Extensions/UIImageView+Ext.swift +++ b/IVPNClient/Utilities/Extensions/UIImageView+Ext.swift @@ -28,11 +28,7 @@ extension UIImageView { func setFlagIconBorder() { layer.cornerRadius = 2.0 layer.shadowRadius = 0.5 - if #available(iOS 13.0, *) { - layer.shadowColor = UIColor.label.cgColor - } else { - layer.shadowColor = UIColor.black.cgColor - } + layer.shadowColor = UIColor.label.cgColor layer.shadowOffset = CGSize(width: 0, height: 0) layer.shadowOpacity = 0.3 backgroundColor = UIColor.clear diff --git a/IVPNClient/Utilities/Extensions/UIViewController+Ext.swift b/IVPNClient/Utilities/Extensions/UIViewController+Ext.swift index 25191cbad..3ad24747a 100644 --- a/IVPNClient/Utilities/Extensions/UIViewController+Ext.swift +++ b/IVPNClient/Utilities/Extensions/UIViewController+Ext.swift @@ -61,11 +61,10 @@ extension UIViewController { // MARK: - @IBActions - @IBAction func dismissViewController(_ sender: Any) { - if #available(iOS 13.0, *) { - if let presentationController = navigationController?.presentationController { - presentationController.delegate?.presentationControllerDidDismiss?(presentationController) - } + if let presentationController = navigationController?.presentationController { + presentationController.delegate?.presentationControllerDidDismiss?(presentationController) } + navigationController?.dismiss(animated: true) }