Add tunnel provider identifier.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
762618ee5a
commit
2b7aa04d40
|
@ -16,6 +16,7 @@ extension Tunnel {
|
||||||
return NSFetchRequest<Tunnel>(entityName: "Tunnel")
|
return NSFetchRequest<Tunnel>(entityName: "Tunnel")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NSManaged public var tunnelIdentifier: String?
|
||||||
@NSManaged public var title: String?
|
@NSManaged public var title: String?
|
||||||
@NSManaged public var interface: Interface?
|
@NSManaged public var interface: Interface?
|
||||||
@NSManaged public var peers: NSOrderedSet?
|
@NSManaged public var peers: NSOrderedSet?
|
||||||
|
|
|
@ -13,6 +13,7 @@ extension Tunnel {
|
||||||
var providerConfiguration = [String: Any]()
|
var providerConfiguration = [String: Any]()
|
||||||
|
|
||||||
providerConfiguration["title"] = self.title
|
providerConfiguration["title"] = self.title
|
||||||
|
providerConfiguration["tunnelIdentifier"] = self.tunnelIdentifier
|
||||||
var settingsString = "replace_peers=true\n"
|
var settingsString = "replace_peers=true\n"
|
||||||
if let interface = interface {
|
if let interface = interface {
|
||||||
settingsString += generateInterfaceProviderConfiguration(interface)
|
settingsString += generateInterfaceProviderConfiguration(interface)
|
||||||
|
|
|
@ -17,12 +17,13 @@
|
||||||
</entity>
|
</entity>
|
||||||
<entity name="Tunnel" representedClassName="Tunnel" syncable="YES">
|
<entity name="Tunnel" representedClassName="Tunnel" syncable="YES">
|
||||||
<attribute name="title" optional="YES" attributeType="String" syncable="YES"/>
|
<attribute name="title" optional="YES" attributeType="String" syncable="YES"/>
|
||||||
|
<attribute name="tunnelIdentifier" attributeType="String" syncable="YES"/>
|
||||||
<relationship name="interface" maxCount="1" deletionRule="Cascade" destinationEntity="Interface" inverseName="tunnel" inverseEntity="Interface" syncable="YES"/>
|
<relationship name="interface" maxCount="1" deletionRule="Cascade" destinationEntity="Interface" inverseName="tunnel" inverseEntity="Interface" syncable="YES"/>
|
||||||
<relationship name="peers" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="Peer" inverseName="tunnel" inverseEntity="Peer" syncable="YES"/>
|
<relationship name="peers" toMany="YES" deletionRule="Cascade" ordered="YES" destinationEntity="Peer" inverseName="tunnel" inverseEntity="Peer" syncable="YES"/>
|
||||||
</entity>
|
</entity>
|
||||||
<elements>
|
<elements>
|
||||||
<element name="Interface" positionX="-54" positionY="-9" width="128" height="120"/>
|
<element name="Interface" positionX="-54" positionY="-9" width="128" height="120"/>
|
||||||
<element name="Peer" positionX="-36" positionY="9" width="128" height="135"/>
|
<element name="Peer" positionX="-36" positionY="9" width="128" height="135"/>
|
||||||
<element name="Tunnel" positionX="160" positionY="192" width="128" height="90"/>
|
<element name="Tunnel" positionX="160" positionY="192" width="128" height="105"/>
|
||||||
</elements>
|
</elements>
|
||||||
</model>
|
</model>
|
|
@ -35,6 +35,7 @@ class TunnelConfigurationTableViewController: UITableViewController {
|
||||||
|
|
||||||
viewContext.performAndWait {
|
viewContext.performAndWait {
|
||||||
tunnel = Tunnel(context: viewContext)
|
tunnel = Tunnel(context: viewContext)
|
||||||
|
tunnel.tunnelIdentifier = UUID().uuidString
|
||||||
let peer = Peer(context: viewContext)
|
let peer = Peer(context: viewContext)
|
||||||
peer.allowedIPs = "0.0.0.0/0, ::/0"
|
peer.allowedIPs = "0.0.0.0/0, ::/0"
|
||||||
tunnel.addToPeers(peer)
|
tunnel.addToPeers(peer)
|
||||||
|
|
Loading…
Reference in New Issue