Compare commits

...

34 Commits

Author SHA1 Message Date
Alessio Nossa a37ae8a99b Merge branch 'master' into an/shortcuts-integration 2024-02-28 10:28:12 +01:00
Alessio Nossa 2f99f5c781 Remove backward compatibility of GetPeers with SiriKit version
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2024-02-28 00:36:19 +01:00
Alessio Nossa 8a2a4ebd9f Add backwards compatibility of GetPeers wit SiriKit version
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2024-02-28 00:36:19 +01:00
Alessio Nossa 06ed6e91ad Update AppIntents Strings
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2024-02-28 00:36:18 +01:00
Alessio Nossa 7da272a421 Rename constant to satisfy SwiftLint
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2024-02-28 00:36:18 +01:00
Alessio Nossa 56c4d6cc4d Remove missing peers error in UpdateTunnelConfiguration Intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2024-02-28 00:36:18 +01:00
Alessio Nossa 7abdf6eaf2 Fix return value of AppIntents in iOS 17
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2024-02-28 00:36:17 +01:00
Alessio Nossa 97bf1c1309 WireguardApp: macOS: Add App Intents to macOS app
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:44:03 +02:00
Alessio Nossa ee035362ec Implement UpdateTunnelConfiguration App Intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:44:02 +02:00
Alessio Nossa e13bc40f88 Implement BuildPeerConfigurationUpdate App Intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:44:02 +02:00
Alessio Nossa eec11c1eef Remove UpdateConfiguration Intent with Dictionary input
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:44:02 +02:00
Alessio Nossa ba250fe1a5 Implement UpdateConfiguration AppIntent with Dictionary as input
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:44:02 +02:00
Alessio Nossa 1cb06536f1 WireguardApp: Add async variant of modify tunnel function
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:44:02 +02:00
Alessio Nossa a0a6f26846 WireguardApp: iOS: Cleanup after SiriKit Intents removal
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:44:01 +02:00
Alessio Nossa c1d7199f85 Remove WireGuardIntentsExtension
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:09:21 +02:00
Alessio Nossa d05a1693e2 Removed UpdateConfigurationIntent SiriKit Intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:09:21 +02:00
Alessio Nossa bee5d346b1 Implement GetPeers AppIntent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-12 00:09:21 +02:00
Alessio Nossa 2952206138 Remove GetPeers SiriKit Intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-05 13:42:56 +02:00
Alessio Nossa 7ec6974005 Complete cleanup after SetTunnelStatus Intent removal
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-01 16:12:32 +02:00
Alessio Nossa 63c09565f2 Removed SetTunnelStatus
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2023-04-01 16:00:24 +02:00
Jason A. Donenfeld 2fec12a6e1 App: version bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-02-15 14:20:52 +01:00
Jason A. Donenfeld 7b279383d1 App: bump copyright
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-02-15 14:20:35 +01:00
Jason A. Donenfeld 901fe1cf58 App: bump minimum OS versions
This allows us to remove a good deal of legacy cruft.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-02-15 14:20:30 +01:00
Jason A. Donenfeld ccc7472fd7 WireGuardKitGo: bump
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-02-14 16:09:14 +01:00
John Biggs 12b095470a WireGuardKit: fix incorrect IP address allocation size
According to [1], the `capacity` parameter is specified as "the number
of instances of T in the re-bound region" and not the total size of the
rebound struct.

Without this patch, there are crashes in the extension with the
following error:

  Fatal error: self must be a properly aligned pointer for types Pointee and T`

Since the subsequent line in the code only reads `sizeof(in_addr)` or
`sizeof(in6_addr)` anyway, change the `capacity` parameter to just be a
count of 1.

[1] https://developer.apple.com/documentation/swift/unsafepointer/withmemoryrebound(to:capacity:_:)

Signed-off-by: John Biggs <john.biggs@proton.ch>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2023-02-08 13:08:40 -03:00
Jason A. Donenfeld 9c07693951 global: apply MIT more consistently
People keep asking.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2022-11-17 01:17:52 +01:00
Alessio Nossa c29787f898 WireguardApp: iOS: Added Siri shortcuts donations for SetTunnelStatus intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2022-02-01 20:14:21 +01:00
Alessio Nossa bb6ea1b2f3 Implemented SetTunnelStatus intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2022-02-01 20:14:02 +01:00
Alessio Nossa fe3f2d089b Implemented UpdateConfiguration intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2022-02-01 20:13:38 +01:00
Alessio Nossa ceabb4ea34 WireguardApp: iOS: Moved tunnelsManager initialization to AppDelegate
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2022-02-01 20:13:13 +01:00
Alessio Nossa ab1e96fcdc Implemented GetPeers intent
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2022-02-01 20:12:47 +01:00
Alessio Nossa 0dd0672844 project: Added sources to WireGuardIntentsExtensioniOS
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2022-02-01 20:12:15 +01:00
Alessio Nossa 3c63c386b9 project: Added WireGuardIntentsExtensioniOS target and Siri capability
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2022-02-01 20:11:33 +01:00
Alessio Nossa a0fe44d214 Automatic configuration files changes by Xcode
Signed-off-by: Alessio Nossa <alessio.nossa@gmail.com>
2022-02-01 20:10:59 +01:00
138 changed files with 1340 additions and 349 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in
+2 -2
View File
@@ -6,8 +6,8 @@ import PackageDescription
let package = Package( let package = Package(
name: "WireGuardKit", name: "WireGuardKit",
platforms: [ platforms: [
.macOS(.v10_14), .macOS(.v12),
.iOS(.v12) .iOS(.v15)
], ],
products: [ products: [
.library(name: "WireGuardKit", targets: ["WireGuardKit"]) .library(name: "WireGuardKit", targets: ["WireGuardKit"])
+1 -1
View File
@@ -18,7 +18,7 @@ $ cp Sources/WireGuardApp/Config/Developer.xcconfig.template Sources/WireGuardAp
$ vim Sources/WireGuardApp/Config/Developer.xcconfig $ vim Sources/WireGuardApp/Config/Developer.xcconfig
``` ```
- Install swiftlint and go 1.15: - Install swiftlint and go 1.19:
``` ```
$ brew install swiftlint go $ brew install swiftlint go
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
import os.log import os.log
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
import Security import Security
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
import os.log import os.log
+1 -1
View File
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: MIT /* SPDX-License-Identifier: MIT
* *
* Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. * Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
*/ */
#include <string.h> #include <string.h>
+1 -1
View File
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: MIT /* SPDX-License-Identifier: MIT
* *
* Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. * Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
*/ */
#ifndef RINGLOGGER_H #ifndef RINGLOGGER_H
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import NetworkExtension import NetworkExtension
@@ -82,24 +82,22 @@ extension NETunnelProviderProtocol {
return true return true
} }
#elseif os(iOS) #elseif os(iOS)
if #available(iOS 15, *) { /* Update the stored reference from the old iOS 14 one to the canonical iOS 15 one.
/* Update the stored reference from the old iOS 14 one to the canonical iOS 15 one. * The iOS 14 ones are 96 bits, while the iOS 15 ones are 160 bits. We do this so
* The iOS 14 ones are 96 bits, while the iOS 15 ones are 160 bits. We do this so * that we can have fast set exclusion in deleteReferences safely. */
* that we can have fast set exclusion in deleteReferences safely. */ if passwordReference != nil && passwordReference!.count == 12 {
if passwordReference != nil && passwordReference!.count == 12 { var result: CFTypeRef?
var result: CFTypeRef? let ret = SecItemCopyMatching([kSecValuePersistentRef: passwordReference!,
let ret = SecItemCopyMatching([kSecValuePersistentRef: passwordReference!, kSecReturnPersistentRef: true] as CFDictionary,
kSecReturnPersistentRef: true] as CFDictionary, &result)
&result) if ret != errSecSuccess || result == nil {
if ret != errSecSuccess || result == nil { return false
return false }
} guard let newReference = result as? Data else { return false }
guard let newReference = result as? Data else { return false } if !newReference.elementsEqual(passwordReference!) {
if !newReference.elementsEqual(passwordReference!) { wg_log(.info, message: "Migrating iOS 14-style keychain reference to iOS 15-style keychain reference for '\(name)'")
wg_log(.info, message: "Migrating iOS 14-style keychain reference to iOS 15-style keychain reference for '\(name)'") passwordReference = newReference
passwordReference = newReference return true
return true
}
} }
} }
#endif #endif
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// iOS permission prompts // iOS permission prompts
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names
+2 -2
View File
@@ -1,2 +1,2 @@
VERSION_NAME = 1.0.15 VERSION_NAME = 1.0.16
VERSION_ID = 26 VERSION_ID = 27
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import NetworkExtension import NetworkExtension
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import NetworkExtension import NetworkExtension
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import NetworkExtension import NetworkExtension
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
import NetworkExtension import NetworkExtension
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
import NetworkExtension import NetworkExtension
@@ -206,6 +206,7 @@ class TunnelsManager {
} }
} }
@available(*, renamed: "modify(tunnel:tunnelConfiguration:onDemandOption:shouldEnsureOnDemandEnabled:)")
func modify(tunnel: TunnelContainer, tunnelConfiguration: TunnelConfiguration, func modify(tunnel: TunnelContainer, tunnelConfiguration: TunnelConfiguration,
onDemandOption: ActivateOnDemandOption, onDemandOption: ActivateOnDemandOption,
shouldEnsureOnDemandEnabled: Bool = false, shouldEnsureOnDemandEnabled: Bool = false,
@@ -299,6 +300,22 @@ class TunnelsManager {
} }
} }
@available(iOS 13.0, macOS 10.15.0, *)
func modify(tunnel: TunnelContainer, tunnelConfiguration: TunnelConfiguration,
onDemandOption: ActivateOnDemandOption,
shouldEnsureOnDemandEnabled: Bool = false) async throws {
return try await withCheckedThrowingContinuation { continuation in
modify(tunnel: tunnel, tunnelConfiguration: tunnelConfiguration, onDemandOption: onDemandOption, shouldEnsureOnDemandEnabled: shouldEnsureOnDemandEnabled) { error in
if let error = error {
continuation.resume(throwing: error)
return
}
continuation.resume(returning: ())
}
}
}
func remove(tunnel: TunnelContainer, completionHandler: @escaping (TunnelsManagerError?) -> Void) { func remove(tunnel: TunnelContainer, completionHandler: @escaping (TunnelsManagerError?) -> Void) {
let tunnelProviderManager = tunnel.tunnelProvider let tunnelProviderManager = tunnel.tunnelProvider
#if os(macOS) #if os(macOS)
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
protocol ErrorPresenterProtocol { protocol ErrorPresenterProtocol {
static func showErrorAlert(title: String, message: String, from sourceVC: AnyObject?, onPresented: (() -> Void)?, onDismissal: (() -> Void)?) static func showErrorAlert(title: String, message: String, from sourceVC: AnyObject?, onPresented: (() -> Void)?, onDismissal: (() -> Void)?)
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
import LocalAuthentication import LocalAuthentication
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
+29 -1
View File
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
import os.log import os.log
import AppIntents
@UIApplicationMain @UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate { class AppDelegate: UIResponder, UIApplicationDelegate {
@@ -11,6 +12,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var mainVC: MainViewController? var mainVC: MainViewController?
var isLaunchedForSpecificAction = false var isLaunchedForSpecificAction = false
var tunnelsManager: TunnelsManager?
static let tunnelsManagerReadyNotificationName: Notification.Name = Notification.Name(rawValue: "com.wireguard.ios.tunnelsManagerReadyNotification")
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
Logger.configureGlobal(tagged: "APP", withFilePath: FileManager.logFileURL?.path) Logger.configureGlobal(tagged: "APP", withFilePath: FileManager.logFileURL?.path)
@@ -29,6 +34,29 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
self.mainVC = mainVC self.mainVC = mainVC
// Create the tunnels manager, and when it's ready, inform tunnelsListVC
TunnelsManager.create { [weak self] result in
guard let self = self else { return }
switch result {
case .failure(let error):
ErrorPresenter.showErrorAlert(error: error, from: self.mainVC)
case .success(let tunnelsManager):
self.tunnelsManager = tunnelsManager
self.mainVC?.tunnelsListVC?.setTunnelsManager(tunnelsManager: tunnelsManager)
tunnelsManager.activationDelegate = self.mainVC
if #available(iOS 16.0, *) {
AppDependencyManager.shared.add(dependency: tunnelsManager)
}
NotificationCenter.default.post(name: AppDelegate.tunnelsManagerReadyNotificationName,
object: self,
userInfo: nil)
}
}
return true return true
} }
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
import os.log import os.log
+9 -8
View File
@@ -2,10 +2,10 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"> <plist version="1.0">
<dict> <dict>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>CFBundleDevelopmentRegion</key> <key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string> <string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleDisplayName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleDocumentTypes</key> <key>CFBundleDocumentTypes</key>
<array> <array>
<dict> <dict>
@@ -64,8 +64,6 @@
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleDisplayName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string> <string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
@@ -74,17 +72,22 @@
<string>$(VERSION_NAME)</string> <string>$(VERSION_NAME)</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>$(VERSION_ID)</string> <string>$(VERSION_ID)</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSRequiresIPhoneOS</key> <key>LSRequiresIPhoneOS</key>
<true/> <true/>
<key>LSSupportsOpeningDocumentsInPlace</key> <key>LSSupportsOpeningDocumentsInPlace</key>
<false/> <false/>
<key>NSCameraUsageDescription</key> <key>NSCameraUsageDescription</key>
<string>Localized</string> <string>Localized</string>
<key>NSFaceIDUsageDescription</key>
<string>Localized</string>
<key>NSUserActivityTypes</key>
<array/>
<key>UILaunchStoryboardName</key> <key>UILaunchStoryboardName</key>
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key> <key>UIRequiredDeviceCapabilities</key>
<array> <array/>
</array>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>
@@ -123,8 +126,6 @@
</dict> </dict>
</dict> </dict>
</array> </array>
<key>NSFaceIDUsageDescription</key>
<string>Localized</string>
<key>com.wireguard.ios.app_group_id</key> <key>com.wireguard.ios.app_group_id</key>
<string>group.$(APP_ID_IOS)</string> <string>group.$(APP_ID_IOS)</string>
</dict> </dict>
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -9,11 +9,7 @@ class KeyValueCell: UITableViewCell {
let keyLabel = UILabel() let keyLabel = UILabel()
keyLabel.font = UIFont.preferredFont(forTextStyle: .body) keyLabel.font = UIFont.preferredFont(forTextStyle: .body)
keyLabel.adjustsFontForContentSizeCategory = true keyLabel.adjustsFontForContentSizeCategory = true
if #available(iOS 13.0, *) { keyLabel.textColor = .label
keyLabel.textColor = .label
} else {
keyLabel.textColor = .black
}
keyLabel.textAlignment = .left keyLabel.textAlignment = .left
return keyLabel return keyLabel
}() }()
@@ -35,11 +31,7 @@ class KeyValueCell: UITableViewCell {
valueTextField.autocapitalizationType = .none valueTextField.autocapitalizationType = .none
valueTextField.autocorrectionType = .no valueTextField.autocorrectionType = .no
valueTextField.spellCheckingType = .no valueTextField.spellCheckingType = .no
if #available(iOS 13.0, *) { valueTextField.textColor = .secondaryLabel
valueTextField.textColor = .secondaryLabel
} else {
valueTextField.textColor = .gray
}
return valueTextField return valueTextField
}() }()
@@ -64,18 +56,10 @@ class KeyValueCell: UITableViewCell {
var isValueValid = true { var isValueValid = true {
didSet { didSet {
if #available(iOS 13.0, *) { if isValueValid {
if isValueValid { keyLabel.textColor = .label
keyLabel.textColor = .label
} else {
keyLabel.textColor = .systemRed
}
} else { } else {
if isValueValid { keyLabel.textColor = .systemRed
keyLabel.textColor = .black
} else {
keyLabel.textColor = .red
}
} }
} }
} }
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -16,11 +16,7 @@ class SwitchCell: UITableViewCell {
get { return switchView.isEnabled } get { return switchView.isEnabled }
set(value) { set(value) {
switchView.isEnabled = value switchView.isEnabled = value
if #available(iOS 13.0, *) { textLabel?.textColor = value ? .label : .secondaryLabel
textLabel?.textColor = value ? .label : .secondaryLabel
} else {
textLabel?.textColor = value ? .black : .gray
}
} }
} }
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -28,11 +28,7 @@ class TextCell: UITableViewCell {
override func prepareForReuse() { override func prepareForReuse() {
super.prepareForReuse() super.prepareForReuse()
message = "" message = ""
if #available(iOS 13.0, *) { setTextColor(.label)
setTextColor(.label)
} else {
setTextColor(.black)
}
setTextAlignment(.left) setTextAlignment(.left)
} }
} }
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -30,11 +30,7 @@ class TunnelEditEditableKeyValueCell: TunnelEditKeyValueCell {
super.init(style: style, reuseIdentifier: reuseIdentifier) super.init(style: style, reuseIdentifier: reuseIdentifier)
copyableGesture = false copyableGesture = false
if #available(iOS 13.0, *) { valueTextField.textColor = .label
valueTextField.textColor = .label
} else {
valueTextField.textColor = .black
}
valueTextField.isEnabled = true valueTextField.isEnabled = true
valueLabelScrollView.isScrollEnabled = false valueLabelScrollView.isScrollEnabled = false
valueTextField.widthAnchor.constraint(equalTo: valueLabelScrollView.widthAnchor).isActive = true valueTextField.widthAnchor.constraint(equalTo: valueLabelScrollView.widthAnchor).isActive = true
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -41,21 +41,13 @@ class TunnelListCell: UITableViewCell {
label.font = UIFont.preferredFont(forTextStyle: .caption2) label.font = UIFont.preferredFont(forTextStyle: .caption2)
label.adjustsFontForContentSizeCategory = true label.adjustsFontForContentSizeCategory = true
label.numberOfLines = 1 label.numberOfLines = 1
if #available(iOS 13.0, *) { label.textColor = .secondaryLabel
label.textColor = .secondaryLabel
} else {
label.textColor = .gray
}
return label return label
}() }()
let busyIndicator: UIActivityIndicatorView = { let busyIndicator: UIActivityIndicatorView = {
let busyIndicator: UIActivityIndicatorView let busyIndicator: UIActivityIndicatorView
if #available(iOS 13.0, *) { busyIndicator = UIActivityIndicatorView(style: .medium)
busyIndicator = UIActivityIndicatorView(style: .medium)
} else {
busyIndicator = UIActivityIndicatorView(style: .gray)
}
busyIndicator.hidesWhenStopped = true busyIndicator.hidesWhenStopped = true
return busyIndicator return busyIndicator
}() }()
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -15,15 +15,9 @@ class LogViewController: UIViewController {
}() }()
let busyIndicator: UIActivityIndicatorView = { let busyIndicator: UIActivityIndicatorView = {
if #available(iOS 13.0, *) { let busyIndicator = UIActivityIndicatorView(style: .medium)
let busyIndicator = UIActivityIndicatorView(style: .medium) busyIndicator.hidesWhenStopped = true
busyIndicator.hidesWhenStopped = true return busyIndicator
return busyIndicator
} else {
let busyIndicator = UIActivityIndicatorView(style: .gray)
busyIndicator.hidesWhenStopped = true
return busyIndicator
}
}() }()
let paragraphStyle: NSParagraphStyle = { let paragraphStyle: NSParagraphStyle = {
@@ -41,12 +35,7 @@ class LogViewController: UIViewController {
override func loadView() { override func loadView() {
view = UIView() view = UIView()
if #available(iOS 13.0, *) { view.backgroundColor = .systemBackground
view.backgroundColor = .systemBackground
} else {
view.backgroundColor = .white
}
view.addSubview(textView) view.addSubview(textView)
textView.translatesAutoresizingMaskIntoConstraints = false textView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
@@ -92,15 +81,8 @@ class LogViewController: UIViewController {
let bodyFont = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body) let bodyFont = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.body)
let captionFont = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.caption1) let captionFont = UIFont.preferredFont(forTextStyle: UIFont.TextStyle.caption1)
for logEntry in fetchedLogEntries { for logEntry in fetchedLogEntries {
var bgColor: UIColor let bgColor: UIColor = self.isNextLineHighlighted ? .systemGray3 : .systemBackground
var fgColor: UIColor let fgColor: UIColor = .label
if #available(iOS 13.0, *) {
bgColor = self.isNextLineHighlighted ? .systemGray3 : .systemBackground
fgColor = .label
} else {
bgColor = self.isNextLineHighlighted ? UIColor(white: 0.88, alpha: 1.0) : UIColor.white
fgColor = .black
}
let timestampText = NSAttributedString(string: logEntry.timestamp + "\n", attributes: [.font: captionFont, .backgroundColor: bgColor, .foregroundColor: fgColor, .paragraphStyle: self.paragraphStyle]) let timestampText = NSAttributedString(string: logEntry.timestamp + "\n", attributes: [.font: captionFont, .backgroundColor: bgColor, .foregroundColor: fgColor, .paragraphStyle: self.paragraphStyle])
let messageText = NSAttributedString(string: logEntry.message + "\n", attributes: [.font: bodyFont, .backgroundColor: bgColor, .foregroundColor: fgColor, .paragraphStyle: self.paragraphStyle]) let messageText = NSAttributedString(string: logEntry.message + "\n", attributes: [.font: bodyFont, .backgroundColor: bgColor, .foregroundColor: fgColor, .paragraphStyle: self.paragraphStyle])
richText.append(timestampText) richText.append(timestampText)
@@ -1,21 +1,19 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
class MainViewController: UISplitViewController { class MainViewController: UISplitViewController {
var tunnelsManager: TunnelsManager? var tunnelsManager: TunnelsManager? {
return (UIApplication.shared.delegate as? AppDelegate)?.tunnelsManager
}
var onTunnelsManagerReady: ((TunnelsManager) -> Void)? var onTunnelsManagerReady: ((TunnelsManager) -> Void)?
var tunnelsListVC: TunnelsListTableViewController? var tunnelsListVC: TunnelsListTableViewController?
init() { init() {
let detailVC = UIViewController() let detailVC = UIViewController()
if #available(iOS 13.0, *) { detailVC.view.backgroundColor = .systemBackground
detailVC.view.backgroundColor = .systemBackground
} else {
detailVC.view.backgroundColor = .white
}
let detailNC = UINavigationController(rootViewController: detailVC) let detailNC = UINavigationController(rootViewController: detailVC)
let masterVC = TunnelsListTableViewController() let masterVC = TunnelsListTableViewController()
@@ -42,29 +40,24 @@ class MainViewController: UISplitViewController {
// On iPad, always show both masterVC and detailVC, even in portrait mode, like the Settings app // On iPad, always show both masterVC and detailVC, even in portrait mode, like the Settings app
preferredDisplayMode = .allVisible preferredDisplayMode = .allVisible
// Create the tunnels manager, and when it's ready, inform tunnelsListVC NotificationCenter.default.addObserver(self, selector: #selector(handleTunnelsManagerReady(_:)),
TunnelsManager.create { [weak self] result in name: AppDelegate.tunnelsManagerReadyNotificationName, object: nil)
guard let self = self else { return }
switch result {
case .failure(let error):
ErrorPresenter.showErrorAlert(error: error, from: self)
case .success(let tunnelsManager):
self.tunnelsManager = tunnelsManager
self.tunnelsListVC?.setTunnelsManager(tunnelsManager: tunnelsManager)
tunnelsManager.activationDelegate = self
self.onTunnelsManagerReady?(tunnelsManager)
self.onTunnelsManagerReady = nil
}
}
} }
func allTunnelNames() -> [String]? { func allTunnelNames() -> [String]? {
guard let tunnelsManager = self.tunnelsManager else { return nil } guard let tunnelsManager = self.tunnelsManager else { return nil }
return tunnelsManager.mapTunnels { $0.name } return tunnelsManager.mapTunnels { $0.name }
} }
@objc
func handleTunnelsManagerReady(_ notification: Notification) {
guard let tunnelsManager = self.tunnelsManager else { return }
self.onTunnelsManagerReady?(tunnelsManager)
self.onTunnelsManagerReady = nil
NotificationCenter.default.removeObserver(self, name: AppDelegate.tunnelsManagerReadyNotificationName, object: nil)
}
} }
extension MainViewController: TunnelsManagerActivationDelegate { extension MainViewController: TunnelsManagerActivationDelegate {
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import AVFoundation import AVFoundation
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
import SystemConfiguration.CaptiveNetwork import SystemConfiguration.CaptiveNetwork
@@ -185,11 +185,7 @@ extension SSIDOptionEditTableViewController {
private func noSSIDsCell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell { private func noSSIDsCell(for tableView: UITableView, at indexPath: IndexPath) -> UITableViewCell {
let cell: TextCell = tableView.dequeueReusableCell(for: indexPath) let cell: TextCell = tableView.dequeueReusableCell(for: indexPath)
cell.message = tr("tunnelOnDemandNoSSIDs") cell.message = tr("tunnelOnDemandNoSSIDs")
if #available(iOS 13.0, *) { cell.setTextColor(.secondaryLabel)
cell.setTextColor(.secondaryLabel)
} else {
cell.setTextColor(.gray)
}
cell.setTextAlignment(.center) cell.setTextAlignment(.center)
return cell return cell
} }
@@ -268,23 +264,8 @@ extension SSIDOptionEditTableViewController {
#if targetEnvironment(simulator) #if targetEnvironment(simulator)
completionHandler("Simulator Wi-Fi") completionHandler("Simulator Wi-Fi")
#else #else
if #available(iOS 14, *) { NEHotspotNetwork.fetchCurrent { hotspotNetwork in
NEHotspotNetwork.fetchCurrent { hotspotNetwork in completionHandler(hotspotNetwork?.ssid)
completionHandler(hotspotNetwork?.ssid)
}
} else {
if let supportedInterfaces = CNCopySupportedInterfaces() as? [CFString] {
for interface in supportedInterfaces {
if let networkInfo = CNCopyCurrentNetworkInfo(interface) {
if let ssid = (networkInfo as NSDictionary)[kCNNetworkInfoKeySSID as String] as? String {
completionHandler(!ssid.isEmpty ? ssid : nil)
return
}
}
}
}
completionHandler(nil)
} }
#endif #endif
} }
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
import os.log import os.log
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import UIKit import UIKit
import MobileCoreServices import MobileCoreServices
@@ -33,11 +33,7 @@ class TunnelsListTableViewController: UIViewController {
let busyIndicator: UIActivityIndicatorView = { let busyIndicator: UIActivityIndicatorView = {
let busyIndicator: UIActivityIndicatorView let busyIndicator: UIActivityIndicatorView
if #available(iOS 13.0, *) { busyIndicator = UIActivityIndicatorView(style: .medium)
busyIndicator = UIActivityIndicatorView(style: .medium)
} else {
busyIndicator = UIActivityIndicatorView(style: .gray)
}
busyIndicator.hidesWhenStopped = true busyIndicator.hidesWhenStopped = true
return busyIndicator return busyIndicator
}() }()
@@ -51,11 +47,7 @@ class TunnelsListTableViewController: UIViewController {
override func loadView() { override func loadView() {
view = UIView() view = UIView()
if #available(iOS 13.0, *) { view.backgroundColor = .systemBackground
view.backgroundColor = .systemBackground
} else {
view.backgroundColor = .white
}
tableView.dataSource = self tableView.dataSource = self
tableView.delegate = self tableView.delegate = self
@@ -406,11 +398,7 @@ extension TunnelsListTableViewController: TunnelsManagerListDelegate {
(splitViewController.viewControllers[0] as? UINavigationController)?.popToRootViewController(animated: false) (splitViewController.viewControllers[0] as? UINavigationController)?.popToRootViewController(animated: false)
} else { } else {
let detailVC = UIViewController() let detailVC = UIViewController()
if #available(iOS 13.0, *) { detailVC.view.backgroundColor = .systemBackground
detailVC.view.backgroundColor = .systemBackground
} else {
detailVC.view.backgroundColor = .white
}
let detailNC = UINavigationController(rootViewController: detailVC) let detailNC = UINavigationController(rootViewController: detailVC)
splitViewController.showDetailViewController(detailNC, sender: self) splitViewController.showDetailViewController(detailNC, sender: self)
} }
@@ -1,8 +1,9 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
import ServiceManagement import ServiceManagement
import AppIntents
@NSApplicationMain @NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate { class AppDelegate: NSObject, NSApplicationDelegate {
@@ -58,6 +59,10 @@ class AppDelegate: NSObject, NSApplicationDelegate {
self.tunnelsTracker = tunnelsTracker self.tunnelsTracker = tunnelsTracker
self.statusItemController = statusItemController self.statusItemController = statusItemController
if #available(macOS 13.0, *) {
AppDependencyManager.shared.add(dependency: tunnelsManager)
}
if !isLaunchedAtLogin { if !isLaunchedAtLogin {
self.showManageTunnelsWindow(completion: nil) self.showManageTunnelsWindow(completion: nil)
} }
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
+1 -1
View File
@@ -29,7 +29,7 @@
<key>LSUIElement</key> <key>LSUIElement</key>
<true/> <true/>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.</string> <string>Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string>WireGuard.Application</string> <string>WireGuard.Application</string>
<key>LSApplicationCategoryType</key> <key>LSApplicationCategoryType</key>
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -25,7 +25,7 @@
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string> <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.</string> <string>Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.</string>
<key>NSPrincipalClass</key> <key>NSPrincipalClass</key>
<string>NSApplication</string> <string>NSApplication</string>
<key>LSBackgroundOnly</key> <key>LSBackgroundOnly</key>
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
@@ -14,23 +14,19 @@ int main(int argc, char *argv[])
return 2; return 2;
uint64_t now = clock_gettime_nsec_np(CLOCK_UPTIME_RAW); uint64_t now = clock_gettime_nsec_np(CLOCK_UPTIME_RAW);
if (![[NSData dataWithBytes:&now length:sizeof(now)] writeToURL:[containerUrl URLByAppendingPathComponent:@"login-helper-timestamp.bin"] atomically:YES]) if (![[NSData dataWithBytes:&now length:sizeof(now)] writeToURL:[containerUrl URLByAppendingPathComponent:@"login-helper-timestamp.bin"] atomically:YES])
return 3; return 3;
if (@available(macOS 10.15, *)) {
NSCondition *condition = [[NSCondition alloc] init]; NSCondition *condition = [[NSCondition alloc] init];
NSURL *appURL = [NSWorkspace.sharedWorkspace URLForApplicationWithBundleIdentifier:appId]; NSURL *appURL = [NSWorkspace.sharedWorkspace URLForApplicationWithBundleIdentifier:appId];
if (!appURL) if (!appURL)
return 4; return 4;
NSWorkspaceOpenConfiguration *openConfiguration = [NSWorkspaceOpenConfiguration configuration]; NSWorkspaceOpenConfiguration *openConfiguration = [NSWorkspaceOpenConfiguration configuration];
openConfiguration.activates = NO; openConfiguration.activates = NO;
openConfiguration.addsToRecentItems = NO; openConfiguration.addsToRecentItems = NO;
openConfiguration.hides = YES; openConfiguration.hides = YES;
[NSWorkspace.sharedWorkspace openApplicationAtURL:appURL configuration:openConfiguration completionHandler:^(NSRunningApplication * _Nullable app, NSError * _Nullable error) { [NSWorkspace.sharedWorkspace openApplicationAtURL:appURL configuration:openConfiguration completionHandler:^(NSRunningApplication * _Nullable app, NSError * _Nullable error) {
[condition signal]; [condition signal];
}]; }];
[condition wait]; [condition wait];
} else {
[NSWorkspace.sharedWorkspace launchAppWithBundleIdentifier:appId options:NSWorkspaceLaunchWithoutActivation
additionalEventParamDescriptor:NULL launchIdentifier:NULL];
}
return 0; return 0;
} }
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import AppKit import AppKit
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
import CoreWLAN import CoreWLAN
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,4 +1,4 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: MIT
/* /*
* Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. * Copyright (C) 2015-2020 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/ */
@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: GPL-2.0 */ /* SPDX-License-Identifier: MIT */
/* /*
* Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved. * Copyright (C) 2015-2019 Jason A. Donenfeld <Jason@zx2c4.com>. All Rights Reserved.
*/ */
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Cocoa import Cocoa
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
protocol WireGuardAppError: Error { protocol WireGuardAppError: Error {
typealias AlertText = (title: String, message: String) typealias AlertText = (title: String, message: String)
+1 -1
View File
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
enum WireGuardResult<T> { enum WireGuardResult<T> {
case success(_ value: T) case success(_ value: T)
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
import Foundation import Foundation
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved. // Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
// Generic alert action names // Generic alert action names

Some files were not shown because too many files have changed in this diff Show More