]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
Remove useless whitespace
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 13 Dec 2018 04:26:04 +0000 (05:26 +0100)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 13 Dec 2018 04:26:04 +0000 (05:26 +0100)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift
WireGuard/WireGuard/UI/iOS/ErrorPresenter.swift
WireGuard/WireGuard/UI/iOS/TunnelEditTableViewController.swift
WireGuard/WireGuard/UI/iOS/UITableViewCell+Reuse.swift
WireGuard/WireGuard/VPN/TunnelsManager.swift
WireGuard/WireGuardNetworkExtension/PacketTunnelSettingsGenerator.swift

index 14a6dfb571fd5be56ca818d1e163b5f9c6b78512..a87472061fa9906d8cb9e8dd4eb52b458cf94a7c 100644 (file)
@@ -30,7 +30,7 @@ class WgQuickConfigFileParser {
 
         var parserState = ParserState.notInASection
         var attributes = [String: String]()
-        
+
         for (lineIndex, line) in lines.enumerated() {
             var trimmedLine: String
             if let commentRange = line.range(of: "#") {
@@ -94,7 +94,7 @@ class WgQuickConfigFileParser {
             throw ParseError.noInterface
         }
     }
-    
+
     private static func collate(interfaceAttributes attributes: [String: String], name: String) -> InterfaceConfiguration? {
         // required wg fields
         guard let privateKeyString = attributes["privatekey"] else { return nil }
@@ -130,7 +130,7 @@ class WgQuickConfigFileParser {
         }
         return interface
     }
-    
+
     private static func collate(peerAttributes attributes: [String: String]) -> PeerConfiguration? {
         // required wg fields
         guard let publicKeyString = attributes["publickey"] else { return nil }
@@ -160,5 +160,5 @@ class WgQuickConfigFileParser {
         }
         return peer
     }
-    
+
 }
index 2889694cfa239f61853bcf5c9762160ae02aeebb..ccbd00d252369a57009f0430fda13c4639088ee7 100644 (file)
@@ -7,7 +7,7 @@ import os.log
 class ErrorPresenter {
     static func showErrorAlert(error: WireGuardAppError, from sourceVC: UIViewController?, onPresented: (() -> Void)? = nil, onDismissal: (() -> Void)? = nil) {
         guard let sourceVC = sourceVC else { return }
-        
+
         let (title, message) = error.alertText()
         let okAction = UIAlertAction(title: "OK", style: .default) { _ in
             onDismissal?()
@@ -20,7 +20,7 @@ class ErrorPresenter {
 
     static func showErrorAlert(title: String, message: String, from sourceVC: UIViewController?, onPresented: (() -> Void)? = nil, onDismissal: (() -> Void)? = nil) {
         guard let sourceVC = sourceVC else { return }
-        
+
         let okAction = UIAlertAction(title: "OK", style: .default) { _ in
             onDismissal?()
         }
index 7cd96a2e7a15f119d75b58d2a6e2154a8a7487c1..0386b0aa77d660f8b40876ad41b0fe5edda8b57b 100644 (file)
@@ -199,13 +199,13 @@ extension TunnelEditTableViewController {
             return interfaceFieldKeyValueCell(for: tableView, at: indexPath, with: field)
         }
     }
-    
+
     private func generateKeyPairCell(for tableView: UITableView, at indexPath: IndexPath, with field: TunnelViewModel.InterfaceField) -> UITableViewCell {
         let cell: ButtonCell = tableView.dequeueReusableCell(for: indexPath)
         cell.buttonText = field.rawValue
         cell.onTapped = { [weak self] in
             guard let self = self else { return }
-            
+
             self.tunnelViewModel.interfaceData[.privateKey] = Curve25519.generatePrivateKey().base64EncodedString()
             if let privateKeyRow = self.interfaceFieldsBySection[indexPath.section].firstIndex(of: .privateKey),
                 let publicKeyRow = self.interfaceFieldsBySection[indexPath.section].firstIndex(of: .publicKey) {
@@ -227,7 +227,7 @@ extension TunnelEditTableViewController {
     private func interfaceFieldKeyValueCell(for tableView: UITableView, at indexPath: IndexPath, with field: TunnelViewModel.InterfaceField) -> UITableViewCell {
         let cell: KeyValueCell = tableView.dequeueReusableCell(for: indexPath)
         cell.key = field.rawValue
-        
+
         switch field {
         case .name, .privateKey:
             cell.placeholderText = "Required"
@@ -260,7 +260,7 @@ extension TunnelEditTableViewController {
         if field == .privateKey {
             cell.onValueBeingEdited = { [weak self] value in
                 guard let self = self else { return }
-                
+
                 self.tunnelViewModel.interfaceData[.privateKey] = value
                 if let row = self.interfaceFieldsBySection[indexPath.section].firstIndex(of: .publicKey) {
                     self.tableView.reloadRows(at: [IndexPath(row: row, section: indexPath.section)], with: .none)
@@ -275,7 +275,7 @@ extension TunnelEditTableViewController {
     private func peerCell(for tableView: UITableView, at indexPath: IndexPath, with peerData: TunnelViewModel.PeerData) -> UITableViewCell {
         let peerFieldsToShow = peerData.shouldAllowExcludePrivateIPsControl ? peerFields : peerFields.filter { $0 != .excludePrivateIPs }
         let field = peerFieldsToShow[indexPath.row]
-        
+
         switch field {
         case .deletePeer:
             return deletePeerCell(for: tableView, at: indexPath, peerData: peerData, field: field)
@@ -285,7 +285,7 @@ extension TunnelEditTableViewController {
             return peerFieldKeyValueCell(for: tableView, at: indexPath, peerData: peerData, field: field)
         }
     }
-    
+
     private func deletePeerCell(for tableView: UITableView, at indexPath: IndexPath, peerData: TunnelViewModel.PeerData, field: TunnelViewModel.PeerField) -> UITableViewCell {
         let cell: ButtonCell = tableView.dequeueReusableCell(for: indexPath)
         cell.buttonText = field.rawValue
@@ -304,14 +304,14 @@ extension TunnelEditTableViewController {
                             let rowIndexPath = IndexPath(row: row, section: self.interfaceFieldsBySection.count /* First peer section */)
                             self.tableView.insertRows(at: [rowIndexPath], with: .fade)
                         }
-                        
+
                     }
                 })
             }
         }
         return cell
     }
-    
+
     private func excludePrivateIPsCell(for tableView: UITableView, at indexPath: IndexPath, peerData: TunnelViewModel.PeerData, field: TunnelViewModel.PeerField) -> UITableViewCell {
         let cell: SwitchCell = tableView.dequeueReusableCell(for: indexPath)
         cell.message = field.rawValue
@@ -326,7 +326,7 @@ extension TunnelEditTableViewController {
         }
         return cell
     }
-    
+
     private func peerFieldKeyValueCell(for tableView: UITableView, at indexPath: IndexPath, peerData: TunnelViewModel.PeerData, field: TunnelViewModel.PeerField) -> UITableViewCell {
         let cell: KeyValueCell = tableView.dequeueReusableCell(for: indexPath)
         cell.key = field.rawValue
@@ -350,11 +350,11 @@ extension TunnelEditTableViewController {
 
         cell.isValueValid = !peerData.fieldsWithError.contains(field)
         cell.value = peerData[field]
-        
+
         if field == .allowedIPs {
             cell.onValueBeingEdited = { [weak self, weak peerData] value in
                 guard let self = self, let peerData = peerData else { return }
-                
+
                 let oldValue = peerData.shouldAllowExcludePrivateIPsControl
                 peerData[.allowedIPs] = value
                 if oldValue != peerData.shouldAllowExcludePrivateIPsControl {
@@ -372,7 +372,7 @@ extension TunnelEditTableViewController {
                 peerData?[field] = value
             }
         }
-        
+
         return cell
     }
 
@@ -476,7 +476,7 @@ extension TunnelEditTableViewController {
             let option = activateOnDemandOptions[indexPath.row - 1]
             assert(option != .none)
             activateOnDemandSetting.activateOnDemandOption = option
-            
+
             let indexPaths = (1 ..< 4).map { IndexPath(row: $0, section: indexPath.section) }
             UIView.performWithoutAnimation {
                 tableView.reloadRows(at: indexPaths, with: .none)
index 587f7b15893376b977a1d09652b886f8fd3e6216..21d9a0763c63c5183531f66c830cf5f5b12ff236 100644 (file)
@@ -13,7 +13,7 @@ extension UITableView {
     func register<T: UITableViewCell>(_: T.Type) {
         register(T.self, forCellReuseIdentifier: T.reuseIdentifier)
     }
-    
+
     func dequeueReusableCell<T: UITableViewCell>(for indexPath: IndexPath) -> T {
         //swiftlint:disable:next force_cast
         return dequeueReusableCell(withIdentifier: T.reuseIdentifier, for: indexPath) as! T
index 9d48cdb399c62d985ddc00110278c208cd06a288..95ab071630210a33b4212ad68de416be60ae4281 100644 (file)
@@ -268,16 +268,16 @@ class TunnelsManager {
 
     private func startObservingTunnelStatuses() {
         guard statusObservationToken == nil else { return }
-        
+
         statusObservationToken = NotificationCenter.default.addObserver(forName: .NEVPNStatusDidChange, object: nil, queue: OperationQueue.main) { [weak self] statusChangeNotification in
             guard let self = self else { return }
             guard let session = statusChangeNotification.object as? NETunnelProviderSession else { return }
             guard let tunnelProvider = session.manager as? NETunnelProviderManager else { return }
             guard let tunnel = self.tunnels.first(where: { $0.tunnelProvider == tunnelProvider }) else { return }
-            
+
             os_log("Tunnel '%{public}@' connection status changed to '%{public}@'",
                    log: OSLog.default, type: .debug, tunnel.name, "\(tunnel.tunnelProvider.connection.status)")
-            
+
             // In case our attempt to start the tunnel, didn't succeed
             if tunnel == self.tunnelBeingActivated {
                 if session.status == .disconnected {
@@ -290,7 +290,7 @@ class TunnelsManager {
                     self.tunnelBeingActivated = nil
                 }
             }
-            
+
             // In case we're restarting the tunnel
             if (tunnel.status == .restarting) && (session.status == .disconnected || session.status == .disconnecting) {
                 // Don't change tunnel.status when disconnecting for a restart
@@ -300,7 +300,7 @@ class TunnelsManager {
                 }
                 return
             }
-            
+
             tunnel.refreshStatus()
         }
     }
index d97699da0373b5280003faa3a975e151e98c08ed..9b83297347c734f79b9a4916e6904f0d4b298927 100644 (file)
@@ -80,12 +80,12 @@ class PacketTunnelSettingsGenerator {
         }
 
         let networkSettings = NEPacketTunnelNetworkSettings(tunnelRemoteAddress: remoteAddress)
-        
+
         let dnsServerStrings = tunnelConfiguration.interface.dns.map { $0.stringRepresentation() }
         let dnsSettings = NEDNSSettings(servers: dnsServerStrings)
         dnsSettings.matchDomains = [""] // All DNS queries must first go through the VPN's DNS
         networkSettings.dnsSettings = dnsSettings
-        
+
         let mtu = tunnelConfiguration.interface.mtu ?? 0
         if mtu == 0 {
             // 0 imples automatic MTU, where we set overhead as 80 bytes, which is the worst case for WireGuard
@@ -93,16 +93,16 @@ class PacketTunnelSettingsGenerator {
         } else {
             networkSettings.mtu = NSNumber(value: mtu)
         }
-        
+
         let (ipv4Routes, ipv6Routes) = routes()
         let (ipv4IncludedRoutes, ipv6IncludedRoutes) = includedRoutes()
         let (ipv4ExcludedRoutes, ipv6ExcludedRoutes) = excludedRoutes()
-        
+
         let ipv4Settings = NEIPv4Settings(addresses: ipv4Routes.map { $0.destinationAddress }, subnetMasks: ipv4Routes.map { $0.destinationSubnetMask })
         ipv4Settings.includedRoutes = ipv4IncludedRoutes
         ipv4Settings.excludedRoutes = ipv4ExcludedRoutes
         networkSettings.ipv4Settings = ipv4Settings
-        
+
         let ipv6Settings = NEIPv6Settings(addresses: ipv6Routes.map { $0.destinationAddress }, networkPrefixLengths: ipv6Routes.map { $0.destinationNetworkPrefixLength })
         ipv6Settings.includedRoutes = ipv6IncludedRoutes
         ipv6Settings.excludedRoutes = ipv6ExcludedRoutes
@@ -122,7 +122,7 @@ class PacketTunnelSettingsGenerator {
         octets[3] = UInt8(truncatingIfNeeded: subnetMask)
         return octets.map { String($0) }.joined(separator: ".")
     }
-    
+
     private func routes() -> ([NEIPv4Route], [NEIPv6Route]) {
         var ipv4Routes = [NEIPv4Route]()
         var ipv6Routes = [NEIPv6Route]()
@@ -140,7 +140,7 @@ class PacketTunnelSettingsGenerator {
         }
         return (ipv4Routes, ipv6Routes)
     }
-    
+
     private func includedRoutes() -> ([NEIPv4Route], [NEIPv6Route]) {
         var ipv4IncludedRoutes = [NEIPv4Route]()
         var ipv6IncludedRoutes = [NEIPv6Route]()
@@ -155,7 +155,7 @@ class PacketTunnelSettingsGenerator {
         }
         return (ipv4IncludedRoutes, ipv6IncludedRoutes)
     }
-    
+
     private func excludedRoutes() -> ([NEIPv4Route], [NEIPv6Route]) {
         var ipv4ExcludedRoutes = [NEIPv4Route]()
         var ipv6ExcludedRoutes = [NEIPv6Route]()
@@ -172,7 +172,7 @@ class PacketTunnelSettingsGenerator {
         }
         return (ipv4ExcludedRoutes, ipv6ExcludedRoutes)
     }
-    
+
 }
 
 private extension Data {