WireGuardApp: integrate WireGuardKit sources directly

Signed-off-by: Andrej Mihajlov <and@mullvad.net>
This commit is contained in:
Andrej Mihajlov
2020-12-02 16:10:44 +01:00
parent 0b0898dc3c
commit 547077a808
27 changed files with 188 additions and 85 deletions
-1
View File
@@ -3,7 +3,6 @@
import Foundation
import os.log
import WireGuardKit
public class Logger {
enum LoggerError: Error {
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import NetworkExtension
import WireGuardKit
enum PacketTunnelProviderError: String, Error {
case savedProtocolConfigurationIsInvalid
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Foundation
import WireGuardKit
extension TunnelConfiguration {
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import NetworkExtension
import WireGuardKit
// Creates mock tunnels for the iOS Simulator.
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Foundation
import WireGuardKit
extension TunnelConfiguration {
convenience init(fromUapiConfig uapiConfig: String, basedOn base: TunnelConfiguration? = nil) throws {
@@ -4,7 +4,6 @@
import Foundation
import NetworkExtension
import os.log
import WireGuardKit
protocol TunnelsManagerListDelegate: class {
func tunnelAdded(at index: Int)
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Foundation
import WireGuardKit
class TunnelImporter {
static func importFromFile(urls: [URL], into tunnelsManager: TunnelsManager, sourceVC: AnyObject?, errorPresenterType: ErrorPresenterProtocol.Type, completionHandler: (() -> Void)? = nil) {
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Foundation
import WireGuardKit
class TunnelViewModel {
@@ -3,7 +3,6 @@
import AVFoundation
import UIKit
import WireGuardKit
protocol QRScanViewControllerDelegate: class {
func addScannedQRCode(tunnelConfiguration: TunnelConfiguration, qrScanViewController: QRScanViewController, completionHandler: (() -> Void)?)
@@ -3,7 +3,6 @@
import UIKit
import os.log
import WireGuardKit
class SettingsTableViewController: UITableViewController {
@@ -153,7 +152,7 @@ extension SettingsTableViewController {
}
cell.value = appVersion
} else if field == .goBackendVersion {
cell.value = getWireGuardVersion()
cell.value = wireGuardVersion
}
return cell
} else if field == .exportZipArchive {
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import UIKit
import WireGuardKit
class TunnelDetailTableViewController: UITableViewController {
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import UIKit
import WireGuardKit
protocol TunnelEditTableViewControllerDelegate: class {
func tunnelSaved(tunnel: TunnelContainer)
@@ -4,7 +4,6 @@
import UIKit
import MobileCoreServices
import UserNotifications
import WireGuardKit
class TunnelsListTableViewController: UIViewController {
@@ -3,7 +3,6 @@
import Cocoa
import ServiceManagement
import WireGuardKit
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Cocoa
import WireGuardKit
// We have this in a separate file because we don't want the network extension
// code to see WireGuardAppError and tr(). Also, this extension is used only on macOS.
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Cocoa
import WireGuardKit
class TunnelDetailTableViewController: NSViewController {
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Cocoa
import WireGuardKit
protocol TunnelEditViewControllerDelegate: class {
func tunnelSaved(tunnel: TunnelContainer)
@@ -1,3 +1,5 @@
#include "key.h"
#include "unzip.h"
#include "zip.h"
#include "ringlogger.h"
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Foundation
import WireGuardKit
enum ZipExporterError: WireGuardAppError {
case noTunnelsToExport
@@ -2,7 +2,6 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Foundation
import WireGuardKit
class ZipImporter {
static func importConfigFiles(from url: URL, completion: @escaping (Result<[TunnelConfiguration?], ZipArchiveError>) -> Void) {
@@ -4,7 +4,10 @@
import Foundation
import Network
import NetworkExtension
#if SWIFT_PACKAGE
import WireGuardKitC
#endif
class PacketTunnelSettingsGenerator {
let tunnelConfiguration: TunnelConfiguration
+3
View File
@@ -2,7 +2,10 @@
// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
import Foundation
#if SWIFT_PACKAGE
import WireGuardKitC
#endif
/// The class describing a private key used by WireGuard.
public class PrivateKey: BaseKey {
@@ -3,7 +3,10 @@
import Foundation
import NetworkExtension
#if SWIFT_PACKAGE
import WireGuardKitGo
#endif
public enum WireGuardAdapterError: Error {
/// Failure to locate tunnel file descriptor.
@@ -3,7 +3,6 @@
import Foundation
import NetworkExtension
import WireGuardKit
import os
class PacketTunnelProvider: NEPacketTunnelProvider {
@@ -1 +1,2 @@
//#include "../WireGuardKitC/WireGuardKitC.h"
#include "ringlogger.h"