diff --git a/WireGuard/Models/Tunnel+CoreDataProperties.swift b/WireGuard/Models/Tunnel+CoreDataProperties.swift index 1bea5a0..acbb1f9 100644 --- a/WireGuard/Models/Tunnel+CoreDataProperties.swift +++ b/WireGuard/Models/Tunnel+CoreDataProperties.swift @@ -16,6 +16,7 @@ extension Tunnel { return NSFetchRequest(entityName: "Tunnel") } + @NSManaged public var tunnelIdentifier: String? @NSManaged public var title: String? @NSManaged public var interface: Interface? @NSManaged public var peers: NSOrderedSet? diff --git a/WireGuard/Models/Tunnel+Extension.swift b/WireGuard/Models/Tunnel+Extension.swift index bd025cc..359a831 100644 --- a/WireGuard/Models/Tunnel+Extension.swift +++ b/WireGuard/Models/Tunnel+Extension.swift @@ -13,6 +13,7 @@ extension Tunnel { var providerConfiguration = [String: Any]() providerConfiguration["title"] = self.title + providerConfiguration["tunnelIdentifier"] = self.tunnelIdentifier var settingsString = "replace_peers=true\n" if let interface = interface { settingsString += generateInterfaceProviderConfiguration(interface) diff --git a/WireGuard/Models/WireGuard.xcdatamodeld/WireGuard.xcdatamodel/contents b/WireGuard/Models/WireGuard.xcdatamodeld/WireGuard.xcdatamodel/contents index 48e9027..d888fa1 100644 --- a/WireGuard/Models/WireGuard.xcdatamodeld/WireGuard.xcdatamodel/contents +++ b/WireGuard/Models/WireGuard.xcdatamodeld/WireGuard.xcdatamodel/contents @@ -17,12 +17,13 @@ + - + \ No newline at end of file diff --git a/WireGuard/ViewControllers/TunnelConfigurationTableViewController.swift b/WireGuard/ViewControllers/TunnelConfigurationTableViewController.swift index 5513e75..f761495 100644 --- a/WireGuard/ViewControllers/TunnelConfigurationTableViewController.swift +++ b/WireGuard/ViewControllers/TunnelConfigurationTableViewController.swift @@ -35,6 +35,7 @@ class TunnelConfigurationTableViewController: UITableViewController { viewContext.performAndWait { tunnel = Tunnel(context: viewContext) + tunnel.tunnelIdentifier = UUID().uuidString let peer = Peer(context: viewContext) peer.allowedIPs = "0.0.0.0/0, ::/0" tunnel.addToPeers(peer)