aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift2
-rw-r--r--WireGuard/WireGuard/Tunnel/TunnelErrors.swift1
-rw-r--r--WireGuard/WireGuard/UI/TunnelViewModel.swift2
-rw-r--r--WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift2
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift10
-rw-r--r--WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift2
-rw-r--r--WireGuard/WireGuard/WireGuardAppError.swift1
-rw-r--r--WireGuard/WireGuardNetworkExtension/DNSResolver.swift2
-rw-r--r--WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift2
9 files changed, 11 insertions, 13 deletions
diff --git a/WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift b/WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift
index b3c0acd..f4c52c2 100644
--- a/WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift
+++ b/WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift
@@ -42,7 +42,7 @@ class WgQuickConfigFileParser {
trimmedLine = trimmedLine.trimmingCharacters(in: .whitespaces)
- guard trimmedLine.count > 0 else { continue }
+ guard !trimmedLine.isEmpty else { continue }
let lowercasedLine = line.lowercased()
if let equalsIndex = line.firstIndex(of: "=") {
diff --git a/WireGuard/WireGuard/Tunnel/TunnelErrors.swift b/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
index 16c8072..45c20f6 100644
--- a/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
+++ b/WireGuard/WireGuard/Tunnel/TunnelErrors.swift
@@ -52,6 +52,7 @@ enum TunnelsManagerActivationAttemptError: WireGuardAppError {
enum TunnelsManagerActivationError: WireGuardAppError {
case activationFailed
case activationFailedWithExtensionError(title: String, message: String)
+
var alertText: AlertText {
switch self {
case .activationFailed:
diff --git a/WireGuard/WireGuard/UI/TunnelViewModel.swift b/WireGuard/WireGuard/UI/TunnelViewModel.swift
index 1a88da2..71cb18e 100644
--- a/WireGuard/WireGuard/UI/TunnelViewModel.swift
+++ b/WireGuard/WireGuard/UI/TunnelViewModel.swift
@@ -361,7 +361,7 @@ class TunnelViewModel {
var peersData: [PeerData]
init(tunnelConfiguration: TunnelConfiguration?) {
- let interfaceData: InterfaceData = InterfaceData()
+ let interfaceData = InterfaceData()
var peersData = [PeerData]()
if let tunnelConfiguration = tunnelConfiguration {
interfaceData.validatedConfiguration = tunnelConfiguration.interface
diff --git a/WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift b/WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift
index 4702993..aff17ee 100644
--- a/WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift
+++ b/WireGuard/WireGuard/UI/iOS/View/ButtonCell.swift
@@ -33,7 +33,7 @@ class ButtonCell: UITableViewCell {
button.topAnchor.constraint(equalTo: contentView.layoutMarginsGuide.topAnchor),
contentView.layoutMarginsGuide.bottomAnchor.constraint(equalTo: button.bottomAnchor),
button.centerXAnchor.constraint(equalTo: contentView.centerXAnchor)
- ])
+ ])
button.addTarget(self, action: #selector(buttonTapped), for: .touchUpInside)
}
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift
index 1e231ec..e4b6287 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/QRScanViewController.swift
@@ -76,15 +76,11 @@ class QRScanViewController: UIViewController {
super.viewDidLayoutSubviews()
if let connection = previewLayer?.connection {
-
- let currentDevice: UIDevice = UIDevice.current
-
- let orientation: UIDeviceOrientation = currentDevice.orientation
-
- let previewLayerConnection: AVCaptureConnection = connection
+ let currentDevice = UIDevice.current
+ let orientation = currentDevice.orientation
+ let previewLayerConnection = connection
if previewLayerConnection.isVideoOrientationSupported {
-
switch orientation {
case .portrait:
previewLayerConnection.videoOrientation = .portrait
diff --git a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
index c07657f..9dea8b0 100644
--- a/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/ViewController/TunnelsListTableViewController.swift
@@ -127,7 +127,7 @@ class TunnelsListTableViewController: UIViewController {
present(alert, animated: true, completion: nil)
}
- @objc func settingsButtonTapped(sender: UIBarButtonItem!) {
+ @objc func settingsButtonTapped(sender: UIBarButtonItem) {
guard tunnelsManager != nil else { return }
let settingsVC = SettingsTableViewController(tunnelsManager: tunnelsManager)
diff --git a/WireGuard/WireGuard/WireGuardAppError.swift b/WireGuard/WireGuard/WireGuardAppError.swift
index aa2f909..8b725d7 100644
--- a/WireGuard/WireGuard/WireGuardAppError.swift
+++ b/WireGuard/WireGuard/WireGuardAppError.swift
@@ -3,5 +3,6 @@
protocol WireGuardAppError: Error {
typealias AlertText = (title: String, message: String)
+
var alertText: AlertText { get }
}
diff --git a/WireGuard/WireGuardNetworkExtension/DNSResolver.swift b/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
index a30b512..32cbf78 100644
--- a/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
+++ b/WireGuard/WireGuardNetworkExtension/DNSResolver.swift
@@ -21,7 +21,7 @@ class DNSResolver {
}
static func resolveSync(endpoints: [Endpoint?]) throws -> [Endpoint?] {
- let dispatchGroup: DispatchGroup = DispatchGroup()
+ let dispatchGroup = DispatchGroup()
if isAllEndpointsAlreadyResolved(endpoints: endpoints) {
return endpoints
diff --git a/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift b/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift
index 3aab8a4..7ee0acc 100644
--- a/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift
+++ b/WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift
@@ -36,7 +36,7 @@ class PacketTunnelSettingsGenerator {
if let listenPort = tunnelConfiguration.interface.listenPort {
wgSettings.append("listen_port=\(listenPort)\n")
}
- if tunnelConfiguration.peers.count > 0 {
+ if !tunnelConfiguration.peers.isEmpty {
wgSettings.append("replace_peers=true\n")
}
assert(tunnelConfiguration.peers.count == resolvedEndpoints.count)