diff --git a/DuckDuckGo.xcodeproj/project.pbxproj b/DuckDuckGo.xcodeproj/project.pbxproj index c9919dd4b2..7dc0e24f12 100644 --- a/DuckDuckGo.xcodeproj/project.pbxproj +++ b/DuckDuckGo.xcodeproj/project.pbxproj @@ -231,6 +231,7 @@ 4BBBBA872B02E85400D965DA /* DesignResourcesKit in Frameworks */ = {isa = PBXBuildFile; productRef = 4BBBBA862B02E85400D965DA /* DesignResourcesKit */; }; 4BBBBA922B03291700D965DA /* VPNWaitlistUserText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BBBBA912B03291700D965DA /* VPNWaitlistUserText.swift */; }; 4BC21A2F27238B7500229F0E /* RunLoopExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BC21A2C272388BD00229F0E /* RunLoopExtensionTests.swift */; }; + 4BC8948C2C7902E6009AA141 /* WireGuard in Frameworks */ = {isa = PBXBuildFile; productRef = 4BC8948B2C7902E6009AA141 /* WireGuard */; }; 4BCBE45E2BA7E81F00FC75A1 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 4BCBE45D2BA7E81F00FC75A1 /* PrivacyInfo.xcprivacy */; }; 4BCBE4602BA7E87100FC75A1 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 4BCBE45F2BA7E87100FC75A1 /* PrivacyInfo.xcprivacy */; }; 4BCD14672B05B682000B1E4C /* NetworkProtectionTermsAndConditionsStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BCD14662B05B682000B1E4C /* NetworkProtectionTermsAndConditionsStore.swift */; }; @@ -2914,6 +2915,7 @@ 02025664298818B200E694E7 /* NetworkExtension.framework in Frameworks */, 4B45D85C2BE0B115006061B5 /* Subscription in Frameworks */, 4B470EE4299C6DFB0086EBDC /* Core.framework in Frameworks */, + 4BC8948C2C7902E6009AA141 /* WireGuard in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -6184,6 +6186,7 @@ name = PacketTunnelProvider; packageProductDependencies = ( 4B45D85B2BE0B115006061B5 /* Subscription */, + 4BC8948B2C7902E6009AA141 /* WireGuard */, ); productName = PacketTunnelProvider; productReference = 02025662298818B100E694E7 /* PacketTunnelProvider.appex */; @@ -6597,6 +6600,7 @@ B6F997C22B8F374300476735 /* XCRemoteSwiftPackageReference "apple-toolbox" */, F1D43AF82B99C1D300BAB743 /* XCRemoteSwiftPackageReference "BareBonesBrowser" */, 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */, + 4BC8948A2C7902E6009AA141 /* XCRemoteSwiftPackageReference "wireguard-apple" */, ); productRefGroup = 84E341931E2F7EFB00BDBA6F /* Products */; projectDirPath = ""; @@ -10606,6 +10610,14 @@ version = 2.0.0; }; }; + 4BC8948A2C7902E6009AA141 /* XCRemoteSwiftPackageReference "wireguard-apple" */ = { + isa = XCRemoteSwiftPackageReference; + repositoryURL = "https://github.com/duckduckgo/wireguard-apple"; + requirement = { + kind = exactVersion; + version = 1.1.3; + }; + }; 854007E52B57FB020001BD98 /* XCRemoteSwiftPackageReference "ZIPFoundation" */ = { isa = XCRemoteSwiftPackageReference; repositoryURL = "https://github.com/weichsel/ZIPFoundation.git"; @@ -10619,7 +10631,7 @@ repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit"; requirement = { kind = exactVersion; - version = 186.1.0; + version = 187.0.0; }; }; 9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = { @@ -10755,6 +10767,11 @@ package = F42D541B29DCA40B004C4FF1 /* XCRemoteSwiftPackageReference "DesignResourcesKit" */; productName = DesignResourcesKit; }; + 4BC8948B2C7902E6009AA141 /* WireGuard */ = { + isa = XCSwiftPackageProductDependency; + package = 4BC8948A2C7902E6009AA141 /* XCRemoteSwiftPackageReference "wireguard-apple" */; + productName = WireGuard; + }; 4BE67B002B96B741007335F7 /* Common */ = { isa = XCSwiftPackageProductDependency; package = 98A16C2928A11BDE00A6C003 /* XCRemoteSwiftPackageReference "BrowserServicesKit" */; diff --git a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 6ba7d149b4..039ab9402b 100644 --- a/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/DuckDuckGo.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/DuckDuckGo/BrowserServicesKit", "state" : { - "revision" : "606ccf9e86f5cad3ae83132f46241357feecf152", - "version" : "186.1.0" + "revision" : "db0a7b47918ccfea0946d88424415c104f67c37d", + "version" : "187.0.0" } }, { diff --git a/PacketTunnelProvider/NetworkProtection/NetworkProtectionPacketTunnelProvider.swift b/PacketTunnelProvider/NetworkProtection/NetworkProtectionPacketTunnelProvider.swift index 668c89e439..ea6020ff0e 100644 --- a/PacketTunnelProvider/NetworkProtection/NetworkProtectionPacketTunnelProvider.swift +++ b/PacketTunnelProvider/NetworkProtection/NetworkProtectionPacketTunnelProvider.swift @@ -26,6 +26,7 @@ import NetworkExtension import NetworkProtection import Subscription import WidgetKit +import WireGuard // Initial implementation for initial Network Protection tests. Will be fleshed out with https://app.asana.com/0/1203137811378537/1204630829332227/f final class NetworkProtectionPacketTunnelProvider: PacketTunnelProvider { @@ -374,6 +375,7 @@ final class NetworkProtectionPacketTunnelProvider: PacketTunnelProvider { tunnelHealthStore: NetworkProtectionTunnelHealthStore(), controllerErrorStore: errorStore, snoozeTimingStore: NetworkProtectionSnoozeTimingStore(userDefaults: .networkProtectionGroupDefaults), + wireGuardInterface: DefaultWireGuardInterface(), keychainType: .dataProtection(.unspecified), tokenStore: tokenStore, debugEvents: Self.networkProtectionDebugEvents(controllerErrorStore: errorStore), @@ -444,3 +446,33 @@ final class NetworkProtectionPacketTunnelProvider: PacketTunnelProvider { } } } + +final class DefaultWireGuardInterface: WireGuardInterface { + func turnOn(settings: UnsafePointer, handle: Int32) -> Int32 { + wgTurnOn(settings, handle) + } + + func turnOff(handle: Int32) { + wgTurnOff(handle) + } + + func getConfig(handle: Int32) -> UnsafeMutablePointer? { + return wgGetConfig(handle) + } + + func setConfig(handle: Int32, config: String) -> Int64 { + return wgSetConfig(handle, config) + } + + func bumpSockets(handle: Int32) { + wgBumpSockets(handle) + } + + func disableSomeRoamingForBrokenMobileSemantics(handle: Int32) { + wgDisableSomeRoamingForBrokenMobileSemantics(handle) + } + + func setLogger(context: UnsafeMutableRawPointer?, logFunction: (@convention(c) (UnsafeMutableRawPointer?, Int32, UnsafePointer?) -> Void)?) { + wgSetLogger(context, logFunction) + } +}