aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/WireGuard/UI/iOS
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2018-11-14 19:17:18 +0530
committerRoopesh Chander <roop@roopc.net>2018-11-15 13:39:56 +0530
commitd55672970581ed435dda91f8273b1761ab3d8777 (patch)
tree1c5687c70ac6ff9a5143c96eb8e32a77e3770176 /WireGuard/WireGuard/UI/iOS
parentImporting: Import from zip in a background thread (diff)
downloadwireguard-apple-d55672970581ed435dda91f8273b1761ab3d8777.tar.xz
wireguard-apple-d55672970581ed435dda91f8273b1761ab3d8777.zip
Exporting: No need to check for duplicate names - we disallow it at creation time itself
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard/UI/iOS')
-rw-r--r--WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift11
1 files changed, 2 insertions, 9 deletions
diff --git a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
index fac2005..4024213 100644
--- a/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
+++ b/WireGuard/WireGuard/UI/iOS/SettingsTableViewController.swift
@@ -68,19 +68,12 @@ class SettingsTableViewController: UITableViewController {
return
}
var inputsToArchiver: [(fileName: String, contents: Data)] = []
- var usedNames: Set<String> = []
for i in 0 ..< tunnelsManager.numberOfTunnels() {
guard let tunnelConfiguration = tunnelsManager.tunnel(at: i).tunnelConfiguration() else { continue }
if let contents = WgQuickConfigFileWriter.writeConfigFile(from: tunnelConfiguration) {
let name = tunnelConfiguration.interface.name
- var nameToCheck = name
- var i = 0
- while (usedNames.contains(nameToCheck)) {
- i = i + 1
- nameToCheck = "\(name)\(i)"
- }
- usedNames.insert(nameToCheck)
- inputsToArchiver.append((fileName: "\(nameToCheck).conf", contents: contents))
+ assert(name != tunnelsManager.tunnel(at: i - 1).name)
+ inputsToArchiver.append((fileName: "\(name).conf", contents: contents))
}
}