Skip to content

Commit

Permalink
Merge branch 'master' into keeshux/fix-additional-targets
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux committed Mar 18, 2023
2 parents d3b8f1a + 2fec12a commit f745d0c
Show file tree
Hide file tree
Showing 132 changed files with 898 additions and 305 deletions.
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -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
this software and associated documentation files (the "Software"), to deal in
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import PackageDescription
let package = Package(
name: "WireGuardKit",
platforms: [
.macOS(.v10_14),
.iOS(.v12)
.macOS(.v12),
.iOS(.v15)
],
products: [
.library(name: "WireGuardKit", targets: ["WireGuardKit"])
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $ cp Sources/WireGuardApp/Config/Developer.xcconfig.template Sources/WireGuardAp
$ vim Sources/WireGuardApp/Config/Developer.xcconfig
```

- Install swiftlint and go 1.15:
- Install swiftlint and go 1.19:

```
$ brew install swiftlint go
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/FileManager+Extension.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation
import os.log
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Keychain.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation
import Security
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Logging/Logger.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation
import os.log
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Logging/ringlogger.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: MIT
*
* Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
* Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
*/

#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Logging/ringlogger.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: MIT
*
* Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
* Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.
*/

#ifndef RINGLOGGER_H
Expand Down
36 changes: 17 additions & 19 deletions Sources/Shared/Model/NETunnelProviderProtocol+Extension.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import NetworkExtension

Expand Down Expand Up @@ -82,24 +82,22 @@ extension NETunnelProviderProtocol {
return true
}
#elseif os(iOS)
if #available(iOS 15, *) {
/* 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
* that we can have fast set exclusion in deleteReferences safely. */
if passwordReference != nil && passwordReference!.count == 12 {
var result: CFTypeRef?
let ret = SecItemCopyMatching([kSecValuePersistentRef: passwordReference!,
kSecReturnPersistentRef: true] as CFDictionary,
&result)
if ret != errSecSuccess || result == nil {
return false
}
guard let newReference = result as? Data else { return false }
if !newReference.elementsEqual(passwordReference!) {
wg_log(.info, message: "Migrating iOS 14-style keychain reference to iOS 15-style keychain reference for '\(name)'")
passwordReference = newReference
return true
}
/* 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
* that we can have fast set exclusion in deleteReferences safely. */
if passwordReference != nil && passwordReference!.count == 12 {
var result: CFTypeRef?
let ret = SecItemCopyMatching([kSecValuePersistentRef: passwordReference!,
kSecReturnPersistentRef: true] as CFDictionary,
&result)
if ret != errSecSuccess || result == nil {
return false
}
guard let newReference = result as? Data else { return false }
if !newReference.elementsEqual(passwordReference!) {
wg_log(.info, message: "Migrating iOS 14-style keychain reference to iOS 15-style keychain reference for '\(name)'")
passwordReference = newReference
return true
}
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/Model/String+ArrayConversion.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/Shared/NotificationToken.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/Base.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

// iOS permission prompts

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/Base.lproj/Localizable.strings
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

// Generic alert action names

Expand Down
4 changes: 2 additions & 2 deletions Sources/WireGuardApp/Config/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION_NAME = 1.0.15
VERSION_ID = 26
VERSION_NAME = 1.0.16
VERSION_ID = 27
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/LocalizationHelper.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/Tunnel/ActivateOnDemandOption.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import NetworkExtension

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/Tunnel/MockTunnels.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import NetworkExtension

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/Tunnel/TunnelErrors.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import NetworkExtension

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/Tunnel/TunnelStatus.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation
import NetworkExtension
Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/Tunnel/TunnelsManager.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation
import NetworkExtension
Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/ActivateOnDemandViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/ErrorPresenterProtocol.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

protocol ErrorPresenterProtocol {
static func showErrorAlert(title: String, message: String, from sourceVC: AnyObject?, onPresented: (() -> Void)?, onDismissal: (() -> Void)?)
Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/LogViewHelper.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/PrivateDataConfirmation.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation
import LocalAuthentication
Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/TunnelImporter.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/TunnelViewModel.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit
import os.log
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/ErrorPresenter.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit
import os.log
Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/QuickActionItem.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/RecentTunnelsTracker.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import Foundation

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/UITableViewCell+Reuse.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/View/BorderedTextButton.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/View/ButtonCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/View/CheckmarkCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/View/ChevronCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
2 changes: 1 addition & 1 deletion Sources/WireGuardApp/UI/iOS/View/EditableTextCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
28 changes: 6 additions & 22 deletions Sources/WireGuardApp/UI/iOS/View/KeyValueCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand All @@ -9,11 +9,7 @@ class KeyValueCell: UITableViewCell {
let keyLabel = UILabel()
keyLabel.font = UIFont.preferredFont(forTextStyle: .body)
keyLabel.adjustsFontForContentSizeCategory = true
if #available(iOS 13.0, *) {
keyLabel.textColor = .label
} else {
keyLabel.textColor = .black
}
keyLabel.textColor = .label
keyLabel.textAlignment = .left
return keyLabel
}()
Expand All @@ -35,11 +31,7 @@ class KeyValueCell: UITableViewCell {
valueTextField.autocapitalizationType = .none
valueTextField.autocorrectionType = .no
valueTextField.spellCheckingType = .no
if #available(iOS 13.0, *) {
valueTextField.textColor = .secondaryLabel
} else {
valueTextField.textColor = .gray
}
valueTextField.textColor = .secondaryLabel
return valueTextField
}()

Expand All @@ -64,18 +56,10 @@ class KeyValueCell: UITableViewCell {

var isValueValid = true {
didSet {
if #available(iOS 13.0, *) {
if isValueValid {
keyLabel.textColor = .label
} else {
keyLabel.textColor = .systemRed
}
if isValueValid {
keyLabel.textColor = .label
} else {
if isValueValid {
keyLabel.textColor = .black
} else {
keyLabel.textColor = .red
}
keyLabel.textColor = .systemRed
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions Sources/WireGuardApp/UI/iOS/View/SwitchCell.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2023 WireGuard LLC. All Rights Reserved.

import UIKit

Expand All @@ -16,11 +16,7 @@ class SwitchCell: UITableViewCell {
get { return switchView.isEnabled }
set(value) {
switchView.isEnabled = value
if #available(iOS 13.0, *) {
textLabel?.textColor = value ? .label : .secondaryLabel
} else {
textLabel?.textColor = value ? .black : .gray
}
textLabel?.textColor = value ? .label : .secondaryLabel
}
}

Expand Down
Loading

0 comments on commit f745d0c

Please sign in to comment.