Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d8568b0
Kit: Go: bump module and simplify API
zx2c4 Dec 23, 2020
b67acac
Kit: do not crash on [abcd::] with missing port
zx2c4 Dec 23, 2020
6d57c8b
UI: Avoid force unwrap when checking for errors
Dec 23, 2020
e54a5d9
UI: macOS: Group more than 10 tunnels into submenu
Dec 22, 2020
a613fec
project: sync translations and improve id generation again
zx2c4 Dec 23, 2020
c4f79be
App: version bump
zx2c4 Dec 23, 2020
491301f
UI: iOS: Fix placeholder label alignment in text fields.
Dec 23, 2020
e724c04
UI: iOS: Remove duplicate call to addSubview
Dec 23, 2020
695f868
Kit: Go: mod bump
zx2c4 Dec 23, 2020
7b5b564
Kit: netcfg: add explicit IP mask routes
zx2c4 Jan 1, 2021
6c4f410
UI: iOS: Disable "copy" action on on-demand cells
Jan 6, 2021
b7f69d2
Kit: Go: bump to latest API
zx2c4 Mar 8, 2021
b9ff5c2
README: account for funky xcode paths
zx2c4 Mar 8, 2021
53235eb
UI: iOS: clean up visuals in SSID editor
zx2c4 Mar 8, 2021
eb528c7
UI: iOS: asynchronously load from NEHotspotNetwork on iOS 14
zx2c4 Mar 8, 2021
820fa55
SPM: update exclude rules
Jun 15, 2021
7f5ad3e
Kit: Adapter: iterate through all FDs to find UTUN
zx2c4 Jun 16, 2021
23bf3cf
Kit: Adapter: use more reliable utun detection technique
zx2c4 Jun 16, 2021
060c027
Kit: Go: mod bump
zx2c4 Jun 16, 2021
87f0526
App: version bump
zx2c4 Jun 16, 2021
c1f509d
Kit: add missing import for WireGuardKitC
Jun 17, 2021
13b7204
Global: bump copyright year
zx2c4 Jun 17, 2021
4764a0d
Sync
styrken Sep 15, 2021
05a4ced
Merge branch 'WireGuard-master' into styrk/sync-fork
styrken Sep 15, 2021
eb2141e
Merge pull request #16 from WireGuard/master
styrken Sep 16, 2021
592a230
Added include-guard for when file is included multiple times
styrken Sep 16, 2021
bf10c90
Added simulutargoos
styrken Sep 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion COPYING
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright © 2018-2020 WireGuard LLC. All Rights Reserved.
Copyright © 2018-2021 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
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ let package = Package(
"goruntime-boottime-over-monotonic.diff",
"go.mod",
"go.sum",
"api-ios.go",
"api-apple.go",
"Makefile"
],
publicHeadersPath: ".",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ $ open WireGuard.xcodeproj
the "External Build Tool Configuration":

```
$BUILD_DIR/../../SourcePackages/checkouts/wireguard-apple/Sources/WireGuardKitGo
${BUILD_DIR%Build/*}SourcePackages/checkouts/wireguard-apple/Sources/WireGuardKitGo
```

- Switch to "Build Settings" and find `SDKROOT`.
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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
* Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
* Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.
*/

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

import NetworkExtension

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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.

// iOS permission prompts

Expand Down
4 changes: 3 additions & 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.

// Generic alert action names

Expand Down Expand Up @@ -109,6 +109,7 @@
"tunnelOnDemandSectionTitleAddSSIDs" = "Add SSIDs";
"tunnelOnDemandAddMessageAddConnectedSSID (%@)" = "Add connected: %@";
"tunnelOnDemandAddMessageAddNewSSID" = "Add new";
"tunnelOnDemandSSIDTextFieldPlaceholder" = "SSID";

"tunnelOnDemandKey" = "On demand";
"tunnelOnDemandOptionOff" = "Off";
Expand Down Expand Up @@ -297,6 +298,7 @@
"macMenuNetworksNone" = "Networks: None";

"macMenuTitle" = "WireGuard";
"macTunnelsMenuTitle" = "Tunnels";
"macMenuManageTunnels" = "Manage Tunnels";
"macMenuImportTunnels" = "Import Tunnel(s) from File…";
"macMenuAddEmptyTunnel" = "Add Empty Tunnel…";
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.11
VERSION_ID = 21
VERSION_NAME = 1.0.13
VERSION_ID = 24
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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.

import Foundation
import NetworkExtension
Expand Down
27 changes: 15 additions & 12 deletions 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.

import Foundation
import NetworkExtension
Expand Down Expand Up @@ -260,19 +260,22 @@ class TunnelsManager {
(tunnel.tunnelProvider.connection as? NETunnelProviderSession)?.stopTunnel()
}
}

// Reload tunnel after saving.
// Without this, the tunnel stopes getting updates on the tunnel status from iOS.
tunnelProviderManager.loadFromPreferences { error in
tunnel.tunnelManagerDidChangeTunnelProvider()
if let error = error {
wg_log(.error, message: "Modify: Re-loading after saving configuration failed: \(error)")
completionHandler(TunnelsManagerError.systemErrorOnModifyTunnel(systemError: error))
} else {
completionHandler(nil)

if isActivatingOnDemand {
// Reload tunnel after saving.
// Without this, the tunnel stopes getting updates on the tunnel status from iOS.
tunnelProviderManager.loadFromPreferences { error in
tunnel.isActivateOnDemandEnabled = tunnelProviderManager.isOnDemandEnabled
if let error = error {
wg_log(.error, message: "Modify: Re-loading after saving configuration failed: \(error)")
completionHandler(TunnelsManagerError.systemErrorOnModifyTunnel(systemError: error))
} else {
completionHandler(nil)
}
}
} else {
completionHandler(nil)
}

}
}

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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down
17 changes: 12 additions & 5 deletions 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.

import UIKit

Expand All @@ -9,6 +9,11 @@ class EditableTextCell: UITableViewCell {
set(value) { valueTextField.text = value }
}

var placeholder: String? {
get { return valueTextField.placeholder }
set(value) { valueTextField.placeholder = value }
}

let valueTextField: UITextField = {
let valueTextField = UITextField()
valueTextField.textAlignment = .left
Expand All @@ -29,12 +34,13 @@ class EditableTextCell: UITableViewCell {
valueTextField.delegate = self
contentView.addSubview(valueTextField)
valueTextField.translatesAutoresizingMaskIntoConstraints = false
let bottomAnchorConstraint = contentView.layoutMarginsGuide.bottomAnchor.constraint(equalToSystemSpacingBelow: valueTextField.bottomAnchor, multiplier: 1)
// Reduce the bottom margin by 0.5pt to maintain the default cell height (44pt)
let bottomAnchorConstraint = contentView.layoutMarginsGuide.bottomAnchor.constraint(equalTo: valueTextField.bottomAnchor, constant: -0.5)
bottomAnchorConstraint.priority = .defaultLow
NSLayoutConstraint.activate([
valueTextField.leadingAnchor.constraint(equalToSystemSpacingAfter: contentView.layoutMarginsGuide.leadingAnchor, multiplier: 1),
contentView.layoutMarginsGuide.trailingAnchor.constraint(equalToSystemSpacingAfter: valueTextField.trailingAnchor, multiplier: 1),
valueTextField.topAnchor.constraint(equalToSystemSpacingBelow: contentView.layoutMarginsGuide.topAnchor, multiplier: 1),
valueTextField.leadingAnchor.constraint(equalTo: contentView.layoutMarginsGuide.leadingAnchor),
contentView.layoutMarginsGuide.trailingAnchor.constraint(equalTo: valueTextField.trailingAnchor),
contentView.layoutMarginsGuide.topAnchor.constraint(equalTo: valueTextField.topAnchor),
bottomAnchorConstraint
])
}
Expand All @@ -50,6 +56,7 @@ class EditableTextCell: UITableViewCell {
override func prepareForReuse() {
super.prepareForReuse()
message = ""
placeholder = nil
}
}

Expand Down
13 changes: 9 additions & 4 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-2020 WireGuard LLC. All Rights Reserved.
// Copyright © 2018-2021 WireGuard LLC. All Rights Reserved.

import UIKit

Expand Down Expand Up @@ -27,7 +27,7 @@ class KeyValueCell: UITableViewCell {
}()

let valueTextField: UITextField = {
let valueTextField = UITextField()
let valueTextField = KeyValueCellTextField()
valueTextField.textAlignment = .right
valueTextField.isEnabled = false
valueTextField.font = UIFont.preferredFont(forTextStyle: .body)
Expand Down Expand Up @@ -115,8 +115,6 @@ class KeyValueCell: UITableViewCell {
expandToFitValueLabelConstraint.priority = .defaultLow + 1
expandToFitValueLabelConstraint.isActive = true

contentView.addSubview(valueLabelScrollView)

contentView.addSubview(valueLabelScrollView)
valueLabelScrollView.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([
Expand Down Expand Up @@ -234,3 +232,10 @@ extension KeyValueCell: UITextFieldDelegate {
}

}

class KeyValueCellTextField: UITextField {
override func placeholderRect(forBounds bounds: CGRect) -> CGRect {
// UIKit renders the placeholder label 0.5pt higher
return super.placeholderRect(forBounds: bounds).integral.offsetBy(dx: 0, dy: -0.5)
}
}
Loading