]> git.ipfire.org Git - thirdparty/wireguard-apple.git/commitdiff
All migration stuff moved to one gross file
authorEric Kuck <eric@bluelinelabs.com>
Fri, 21 Dec 2018 18:51:14 +0000 (12:51 -0600)
committerEric Kuck <eric@bluelinelabs.com>
Fri, 21 Dec 2018 18:51:14 +0000 (12:51 -0600)
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
WireGuard/Shared/LegacyConfigMigration.swift [new file with mode: 0644]
WireGuard/Shared/Model/Legacy/LegacyDNSServer.swift [deleted file]
WireGuard/Shared/Model/Legacy/LegacyEndpoint.swift [deleted file]
WireGuard/Shared/Model/Legacy/LegacyIPAddressRange.swift [deleted file]
WireGuard/Shared/Model/Legacy/LegacyInterfaceConfiguration.swift [deleted file]
WireGuard/Shared/Model/Legacy/LegacyPeerConfiguration.swift [deleted file]
WireGuard/Shared/Model/Legacy/LegacyTunnelConfiguration.swift [deleted file]
WireGuard/Shared/NETunnelProviderProtocol+Extension.swift
WireGuard/WireGuard.xcodeproj/project.pbxproj

diff --git a/WireGuard/Shared/LegacyConfigMigration.swift b/WireGuard/Shared/LegacyConfigMigration.swift
new file mode 100644 (file)
index 0000000..bd22ca4
--- /dev/null
@@ -0,0 +1,196 @@
+// SPDX-License-Identifier: MIT
+// Copyright © 2018 WireGuard LLC. All Rights Reserved.
+
+import Foundation
+import Network
+import NetworkExtension
+
+protocol LegacyModel: Decodable {
+    associatedtype Model
+    
+    var migrated: Model { get }
+}
+
+struct LegacyDNSServer: LegacyModel {
+    let address: IPAddress
+    
+    var migrated: DNSServer {
+        return DNSServer(address: address)
+    }
+    
+    init(from decoder: Decoder) throws {
+        let container = try decoder.singleValueContainer()
+        var data = try container.decode(Data.self)
+        let ipAddressFromData: IPAddress? = {
+            switch data.count {
+            case 4: return IPv4Address(data)
+            case 16: return IPv6Address(data)
+            default: return nil
+            }
+        }()
+        guard let ipAddress = ipAddressFromData else {
+            throw DecodingError.invalidData
+        }
+        address = ipAddress
+    }
+    
+    enum DecodingError: Error {
+        case invalidData
+    }
+}
+
+extension Array where Element == LegacyDNSServer {
+    var migrated: [DNSServer] {
+        return map { $0.migrated }
+    }
+}
+
+struct LegacyEndpoint: LegacyModel {
+    let host: Network.NWEndpoint.Host
+    let port: Network.NWEndpoint.Port
+    
+    var migrated: Endpoint {
+        return Endpoint(host: host, port: port)
+    }
+    
+    public init(from decoder: Decoder) throws {
+        let container = try decoder.singleValueContainer()
+        let endpointString = try container.decode(String.self)
+        guard !endpointString.isEmpty else { throw DecodingError.invalidData }
+        let startOfPort: String.Index
+        let hostString: String
+        if endpointString.first! == "[" {
+            // Look for IPv6-style endpoint, like [::1]:80
+            let startOfHost = endpointString.index(after: endpointString.startIndex)
+            guard let endOfHost = endpointString.dropFirst().firstIndex(of: "]") else { throw DecodingError.invalidData }
+            let afterEndOfHost = endpointString.index(after: endOfHost)
+            guard endpointString[afterEndOfHost] == ":" else { throw DecodingError.invalidData }
+            startOfPort = endpointString.index(after: afterEndOfHost)
+            hostString = String(endpointString[startOfHost ..< endOfHost])
+        } else {
+            // Look for an IPv4-style endpoint, like 127.0.0.1:80
+            guard let endOfHost = endpointString.firstIndex(of: ":") else { throw DecodingError.invalidData }
+            startOfPort = endpointString.index(after: endOfHost)
+            hostString = String(endpointString[endpointString.startIndex ..< endOfHost])
+        }
+        guard let endpointPort = NWEndpoint.Port(String(endpointString[startOfPort ..< endpointString.endIndex])) else { throw DecodingError.invalidData }
+        let invalidCharacterIndex = hostString.unicodeScalars.firstIndex { char in
+            return !CharacterSet.urlHostAllowed.contains(char)
+        }
+        guard invalidCharacterIndex == nil else { throw DecodingError.invalidData }
+        host = NWEndpoint.Host(hostString)
+        port = endpointPort
+    }
+    
+    enum DecodingError: Error {
+        case invalidData
+    }
+}
+
+struct LegacyInterfaceConfiguration: LegacyModel {
+    let name: String
+    let privateKey: Data
+    let addresses: [LegacyIPAddressRange]
+    let listenPort: UInt16?
+    let mtu: UInt16?
+    let dns: [LegacyDNSServer]
+    
+    var migrated: InterfaceConfiguration {
+        var interface = InterfaceConfiguration(name: name, privateKey: privateKey)
+        interface.addresses = addresses.migrated
+        interface.listenPort = listenPort
+        interface.mtu = mtu
+        interface.dns = dns.migrated
+        return interface
+    }
+}
+
+struct LegacyIPAddressRange: LegacyModel {
+    let address: IPAddress
+    let networkPrefixLength: UInt8
+    
+    var migrated: IPAddressRange {
+        return IPAddressRange(address: address, networkPrefixLength: networkPrefixLength)
+    }
+    
+    public init(from decoder: Decoder) throws {
+        let container = try decoder.singleValueContainer()
+        var data = try container.decode(Data.self)
+        networkPrefixLength = data.removeLast()
+        let ipAddressFromData: IPAddress? = {
+            switch data.count {
+            case 4: return IPv4Address(data)
+            case 16: return IPv6Address(data)
+            default: return nil
+            }
+        }()
+        guard let ipAddress = ipAddressFromData else { throw DecodingError.invalidData }
+        address = ipAddress
+    }
+    
+    enum DecodingError: Error {
+        case invalidData
+    }
+}
+
+extension Array where Element == LegacyIPAddressRange {
+    var migrated: [IPAddressRange] {
+        return map { $0.migrated }
+    }
+}
+
+struct LegacyPeerConfiguration: LegacyModel {
+    let publicKey: Data
+    let preSharedKey: Data?
+    let allowedIPs: [LegacyIPAddressRange]
+    let endpoint: LegacyEndpoint?
+    let persistentKeepAlive: UInt16?
+    
+    var migrated: PeerConfiguration {
+        var configuration = PeerConfiguration(publicKey: publicKey)
+        configuration.preSharedKey = preSharedKey
+        configuration.allowedIPs = allowedIPs.migrated
+        configuration.endpoint = endpoint?.migrated
+        configuration.persistentKeepAlive = persistentKeepAlive
+        return configuration
+    }
+}
+
+extension Array where Element == LegacyPeerConfiguration {
+    var migrated: [PeerConfiguration] {
+        return map { $0.migrated }
+    }
+}
+
+final class LegacyTunnelConfiguration: LegacyModel {
+    let interface: LegacyInterfaceConfiguration
+    let peers: [LegacyPeerConfiguration]
+    
+    var migrated: TunnelConfiguration {
+        return TunnelConfiguration(interface: interface.migrated, peers: peers.migrated)
+    }
+}
+
+extension NETunnelProviderProtocol {
+    
+    @discardableResult
+    func migrateConfigurationIfNeeded() -> Bool {
+        guard let configurationVersion = providerConfiguration?["tunnelConfigurationVersion"] as? Int else { return false }
+        if configurationVersion == 1 {
+            migrateFromConfigurationV1()
+        } else {
+            fatalError("No migration from configuration version \(configurationVersion) exists.")
+        }
+        return true
+    }
+    
+    private func migrateFromConfigurationV1() {
+        guard let serializedTunnelConfiguration = providerConfiguration?["tunnelConfiguration"] as? Data else { return }
+        guard let configuration = try? JSONDecoder().decode(LegacyTunnelConfiguration.self, from: serializedTunnelConfiguration) else { return }
+        guard let tunnelConfigData = try? JSONEncoder().encode(configuration.migrated) else { return }
+        guard let tunnelConfigDictionary = try? JSONSerialization.jsonObject(with: tunnelConfigData, options: .allowFragments) else { return }
+        
+        providerConfiguration = [Keys.wgQuickConfig.rawValue: tunnelConfigDictionary]
+    }
+    
+}
diff --git a/WireGuard/Shared/Model/Legacy/LegacyDNSServer.swift b/WireGuard/Shared/Model/Legacy/LegacyDNSServer.swift
deleted file mode 100644 (file)
index f2afcd7..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018 WireGuard LLC. All Rights Reserved.
-
-import Foundation
-import Network
-
-struct LegacyDNSServer: Codable {
-    let address: IPAddress
-    
-    init(from decoder: Decoder) throws {
-        let container = try decoder.singleValueContainer()
-        var data = try container.decode(Data.self)
-        let ipAddressFromData: IPAddress? = {
-            switch data.count {
-            case 4: return IPv4Address(data)
-            case 16: return IPv6Address(data)
-            default: return nil
-            }
-        }()
-        guard let ipAddress = ipAddressFromData else {
-            throw DecodingError.invalidData
-        }
-        address = ipAddress
-    }
-    
-    func encode(to encoder: Encoder) throws {
-        var container = encoder.singleValueContainer()
-        try container.encode(address.rawValue)
-    }
-
-    enum DecodingError: Error {
-        case invalidData
-    }
-}
-
-extension LegacyDNSServer {
-    var migrated: DNSServer {
-        return DNSServer(address: address)
-    }
-}
-
-extension Array where Element == LegacyDNSServer {
-    var migrated: [DNSServer] {
-        return map { $0.migrated }
-    }
-}
diff --git a/WireGuard/Shared/Model/Legacy/LegacyEndpoint.swift b/WireGuard/Shared/Model/Legacy/LegacyEndpoint.swift
deleted file mode 100644 (file)
index 7a80be4..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018 WireGuard LLC. All Rights Reserved.
-
-import Foundation
-import Network
-
-struct LegacyEndpoint: Codable {
-    let host: NWEndpoint.Host
-    let port: NWEndpoint.Port
-    
-    public init(from decoder: Decoder) throws {
-        let container = try decoder.singleValueContainer()
-        let endpointString = try container.decode(String.self)
-        guard !endpointString.isEmpty else { throw DecodingError.invalidData }
-        let startOfPort: String.Index
-        let hostString: String
-        if endpointString.first! == "[" {
-            // Look for IPv6-style endpoint, like [::1]:80
-            let startOfHost = endpointString.index(after: endpointString.startIndex)
-            guard let endOfHost = endpointString.dropFirst().firstIndex(of: "]") else { throw DecodingError.invalidData }
-            let afterEndOfHost = endpointString.index(after: endOfHost)
-            guard endpointString[afterEndOfHost] == ":" else { throw DecodingError.invalidData }
-            startOfPort = endpointString.index(after: afterEndOfHost)
-            hostString = String(endpointString[startOfHost ..< endOfHost])
-        } else {
-            // Look for an IPv4-style endpoint, like 127.0.0.1:80
-            guard let endOfHost = endpointString.firstIndex(of: ":") else { throw DecodingError.invalidData }
-            startOfPort = endpointString.index(after: endOfHost)
-            hostString = String(endpointString[endpointString.startIndex ..< endOfHost])
-        }
-        guard let endpointPort = NWEndpoint.Port(String(endpointString[startOfPort ..< endpointString.endIndex])) else { throw DecodingError.invalidData }
-        let invalidCharacterIndex = hostString.unicodeScalars.firstIndex { char in
-            return !CharacterSet.urlHostAllowed.contains(char)
-        }
-        guard invalidCharacterIndex == nil else { throw DecodingError.invalidData }
-        host = NWEndpoint.Host(hostString)
-        port = endpointPort
-    }
-    
-    public func encode(to encoder: Encoder) throws {
-        let stringRepresentation: String
-        switch host {
-        case .name(let hostname, _):
-            stringRepresentation = "\(hostname):\(port)"
-        case .ipv4(let address):
-            stringRepresentation = "\(address):\(port)"
-        case .ipv6(let address):
-            stringRepresentation = "[\(address)]:\(port)"
-        }
-        
-        var container = encoder.singleValueContainer()
-        try container.encode(stringRepresentation)
-    }
-
-    enum DecodingError: Error {
-        case invalidData
-    }
-}
-
-extension LegacyEndpoint {
-    var migrated: Endpoint {
-        return Endpoint(host: host, port: port)
-    }
-}
diff --git a/WireGuard/Shared/Model/Legacy/LegacyIPAddressRange.swift b/WireGuard/Shared/Model/Legacy/LegacyIPAddressRange.swift
deleted file mode 100644 (file)
index ade87f2..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018 WireGuard LLC. All Rights Reserved.
-
-import Foundation
-import Network
-
-struct LegacyIPAddressRange: Codable {
-    let address: IPAddress
-    let networkPrefixLength: UInt8
-    
-    public init(from decoder: Decoder) throws {
-        let container = try decoder.singleValueContainer()
-        var data = try container.decode(Data.self)
-        networkPrefixLength = data.removeLast()
-        let ipAddressFromData: IPAddress? = {
-            switch data.count {
-            case 4: return IPv4Address(data)
-            case 16: return IPv6Address(data)
-            default: return nil
-            }
-        }()
-        guard let ipAddress = ipAddressFromData else { throw DecodingError.invalidData }
-        address = ipAddress
-    }
-    
-    public func encode(to encoder: Encoder) throws {
-        var container = encoder.singleValueContainer()
-        let addressDataLength: Int
-        if address is IPv4Address {
-            addressDataLength = 4
-        } else if address is IPv6Address {
-            addressDataLength = 16
-        } else {
-            fatalError()
-        }
-        var data = Data(capacity: addressDataLength + 1)
-        data.append(address.rawValue)
-        data.append(networkPrefixLength)
-        try container.encode(data)
-    }
-
-    enum DecodingError: Error {
-        case invalidData
-    }
-}
-
-extension LegacyIPAddressRange {
-    var migrated: IPAddressRange {
-        return IPAddressRange(address: address, networkPrefixLength: networkPrefixLength)
-    }
-}
-
-extension Array where Element == LegacyIPAddressRange {
-    var migrated: [IPAddressRange] {
-        return map { $0.migrated }
-    }
-}
diff --git a/WireGuard/Shared/Model/Legacy/LegacyInterfaceConfiguration.swift b/WireGuard/Shared/Model/Legacy/LegacyInterfaceConfiguration.swift
deleted file mode 100644 (file)
index 680c8d7..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018 WireGuard LLC. All Rights Reserved.
-
-import Foundation
-
-struct LegacyInterfaceConfiguration: Codable {
-    let name: String
-    let privateKey: Data
-    let addresses: [LegacyIPAddressRange]
-    let listenPort: UInt16?
-    let mtu: UInt16?
-    let dns: [LegacyDNSServer]
-}
-
-extension LegacyInterfaceConfiguration {
-    var migrated: InterfaceConfiguration {
-        var interface = InterfaceConfiguration(name: name, privateKey: privateKey)
-        interface.addresses = addresses.migrated
-        interface.listenPort = listenPort
-        interface.mtu = mtu
-        interface.dns = dns.migrated
-        return interface
-    }
-}
diff --git a/WireGuard/Shared/Model/Legacy/LegacyPeerConfiguration.swift b/WireGuard/Shared/Model/Legacy/LegacyPeerConfiguration.swift
deleted file mode 100644 (file)
index 5a61b4a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018 WireGuard LLC. All Rights Reserved.
-
-import Foundation
-
-struct LegacyPeerConfiguration: Codable {
-    let publicKey: Data
-    let preSharedKey: Data?
-    let allowedIPs: [LegacyIPAddressRange]
-    let endpoint: LegacyEndpoint?
-    let persistentKeepAlive: UInt16?
-}
-
-extension LegacyPeerConfiguration {
-    var migrated: PeerConfiguration {
-        var configuration = PeerConfiguration(publicKey: publicKey)
-        configuration.preSharedKey = preSharedKey
-        configuration.allowedIPs = allowedIPs.migrated
-        configuration.endpoint = endpoint?.migrated
-        configuration.persistentKeepAlive = persistentKeepAlive
-        return configuration
-    }
-}
-
-extension Array where Element == LegacyPeerConfiguration {
-    var migrated: [PeerConfiguration] {
-        return map { $0.migrated }
-    }
-}
diff --git a/WireGuard/Shared/Model/Legacy/LegacyTunnelConfiguration.swift b/WireGuard/Shared/Model/Legacy/LegacyTunnelConfiguration.swift
deleted file mode 100644 (file)
index ac369b9..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018 WireGuard LLC. All Rights Reserved.
-
-import Foundation
-
-final class LegacyTunnelConfiguration: Codable {
-    let interface: LegacyInterfaceConfiguration
-    let peers: [LegacyPeerConfiguration]
-}
-
-extension LegacyTunnelConfiguration {
-    var migrated: TunnelConfiguration {
-        return TunnelConfiguration(interface: interface.migrated, peers: peers.migrated)
-    }
-}
index 7d6e412df3c9fc93b1341daf4f742ab1de67a83f..6f4e3eb03cf1993b760ef2c176fd6419a42c3a4a 100644 (file)
@@ -52,24 +52,4 @@ extension NETunnelProviderProtocol {
         return serializedThisTunnelConfiguration == serializedOtherTunnelConfiguration
     }
     
-    @discardableResult
-    func migrateConfigurationIfNeeded() -> Bool {
-        guard let configurationVersion = providerConfiguration?["tunnelConfigurationVersion"] as? Int else { return false }
-        if configurationVersion == 1 {
-            migrateFromConfigurationV1()
-        } else {
-            fatalError("No migration from configuration version \(configurationVersion) exists.")
-        }
-        return true
-    }
-    
-    private func migrateFromConfigurationV1() {
-        guard let serializedTunnelConfiguration = providerConfiguration?["tunnelConfiguration"] as? Data else { return }
-        guard let configuration = try? JSONDecoder().decode(LegacyTunnelConfiguration.self, from: serializedTunnelConfiguration) else { return }
-        guard let tunnelConfigData = try? JSONEncoder().encode(configuration.migrated) else { return }
-        guard let tunnelConfigDictionary = try? JSONSerialization.jsonObject(with: tunnelConfigData, options: .allowFragments) else { return }
-        
-        providerConfiguration = [ Keys.wgQuickConfig.rawValue: tunnelConfigDictionary ]
-    }
-    
 }
index 782f2bd10393e6083cbbd7607c274884a409309b..7574451cc57e7d2e113626c84e8d6196d3b627ef 100644 (file)
                5F4541A921C451D100994C13 /* TunnelStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F4541A821C451D100994C13 /* TunnelStatus.swift */; };
                5F4541AE21C7704300994C13 /* NEVPNStatus+CustomStringConvertible.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F4541AD21C7704300994C13 /* NEVPNStatus+CustomStringConvertible.swift */; };
                5F4541B221CBFAEE00994C13 /* String+ArrayConversion.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F4541B121CBFAEE00994C13 /* String+ArrayConversion.swift */; };
+               5F9696AA21CD6AE6008063FE /* LegacyConfigMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F9696A921CD6AE6008063FE /* LegacyConfigMigration.swift */; };
+               5F9696AB21CD6AE6008063FE /* LegacyConfigMigration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F9696A921CD6AE6008063FE /* LegacyConfigMigration.swift */; };
                5FF7B96221CC95DE00A7DD74 /* InterfaceConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96121CC95DE00A7DD74 /* InterfaceConfiguration.swift */; };
                5FF7B96321CC95DE00A7DD74 /* InterfaceConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96121CC95DE00A7DD74 /* InterfaceConfiguration.swift */; };
                5FF7B96521CC95FA00A7DD74 /* PeerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96421CC95FA00A7DD74 /* PeerConfiguration.swift */; };
                5FF7B96621CC95FA00A7DD74 /* PeerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96421CC95FA00A7DD74 /* PeerConfiguration.swift */; };
-               5FF7B96E21CC967B00A7DD74 /* LegacyInterfaceConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96821CC967B00A7DD74 /* LegacyInterfaceConfiguration.swift */; };
-               5FF7B96F21CC967B00A7DD74 /* LegacyInterfaceConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96821CC967B00A7DD74 /* LegacyInterfaceConfiguration.swift */; };
-               5FF7B97021CC967B00A7DD74 /* LegacyIPAddressRange.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96921CC967B00A7DD74 /* LegacyIPAddressRange.swift */; };
-               5FF7B97121CC967B00A7DD74 /* LegacyIPAddressRange.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96921CC967B00A7DD74 /* LegacyIPAddressRange.swift */; };
-               5FF7B97221CC967B00A7DD74 /* LegacyEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96A21CC967B00A7DD74 /* LegacyEndpoint.swift */; };
-               5FF7B97321CC967B00A7DD74 /* LegacyEndpoint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96A21CC967B00A7DD74 /* LegacyEndpoint.swift */; };
-               5FF7B97421CC967B00A7DD74 /* LegacyDNSServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96B21CC967B00A7DD74 /* LegacyDNSServer.swift */; };
-               5FF7B97521CC967B00A7DD74 /* LegacyDNSServer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96B21CC967B00A7DD74 /* LegacyDNSServer.swift */; };
-               5FF7B97621CC967B00A7DD74 /* LegacyPeerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96C21CC967B00A7DD74 /* LegacyPeerConfiguration.swift */; };
-               5FF7B97721CC967B00A7DD74 /* LegacyPeerConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96C21CC967B00A7DD74 /* LegacyPeerConfiguration.swift */; };
-               5FF7B97821CC967B00A7DD74 /* LegacyTunnelConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96D21CC967B00A7DD74 /* LegacyTunnelConfiguration.swift */; };
-               5FF7B97921CC967B00A7DD74 /* LegacyTunnelConfiguration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FF7B96D21CC967B00A7DD74 /* LegacyTunnelConfiguration.swift */; };
                6F5A2B4621AFDED40081EDD8 /* FileManager+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F5A2B4421AFDE020081EDD8 /* FileManager+Extension.swift */; };
                6F5A2B4821AFF49A0081EDD8 /* FileManager+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F5A2B4421AFDE020081EDD8 /* FileManager+Extension.swift */; };
                6F5D0C1D218352EF000F85AD /* PacketTunnelProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6F5D0C1C218352EF000F85AD /* PacketTunnelProvider.swift */; };
                5F4541A821C451D100994C13 /* TunnelStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TunnelStatus.swift; sourceTree = "<group>"; };
                5F4541AD21C7704300994C13 /* NEVPNStatus+CustomStringConvertible.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NEVPNStatus+CustomStringConvertible.swift"; sourceTree = "<group>"; };
                5F4541B121CBFAEE00994C13 /* String+ArrayConversion.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+ArrayConversion.swift"; sourceTree = "<group>"; };
+               5F9696A921CD6AE6008063FE /* LegacyConfigMigration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LegacyConfigMigration.swift; sourceTree = "<group>"; };
                5FF7B96121CC95DE00A7DD74 /* InterfaceConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceConfiguration.swift; sourceTree = "<group>"; };
                5FF7B96421CC95FA00A7DD74 /* PeerConfiguration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeerConfiguration.swift; sourceTree = "<group>"; };
-               5FF7B96821CC967B00A7DD74 /* LegacyInterfaceConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyInterfaceConfiguration.swift; sourceTree = "<group>"; };
-               5FF7B96921CC967B00A7DD74 /* LegacyIPAddressRange.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyIPAddressRange.swift; sourceTree = "<group>"; };
-               5FF7B96A21CC967B00A7DD74 /* LegacyEndpoint.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyEndpoint.swift; sourceTree = "<group>"; };
-               5FF7B96B21CC967B00A7DD74 /* LegacyDNSServer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyDNSServer.swift; sourceTree = "<group>"; };
-               5FF7B96C21CC967B00A7DD74 /* LegacyPeerConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyPeerConfiguration.swift; sourceTree = "<group>"; };
-               5FF7B96D21CC967B00A7DD74 /* LegacyTunnelConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LegacyTunnelConfiguration.swift; sourceTree = "<group>"; };
                6F5A2B4421AFDE020081EDD8 /* FileManager+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "FileManager+Extension.swift"; sourceTree = "<group>"; };
                6F5D0C1421832391000F85AD /* DNSResolver.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DNSResolver.swift; sourceTree = "<group>"; };
                6F5D0C1A218352EF000F85AD /* WireGuardNetworkExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = WireGuardNetworkExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
                        path = ViewController;
                        sourceTree = "<group>";
                };
-               5FF7B96721CC966300A7DD74 /* Legacy */ = {
-                       isa = PBXGroup;
-                       children = (
-                               5FF7B96B21CC967B00A7DD74 /* LegacyDNSServer.swift */,
-                               5FF7B96A21CC967B00A7DD74 /* LegacyEndpoint.swift */,
-                               5FF7B96821CC967B00A7DD74 /* LegacyInterfaceConfiguration.swift */,
-                               5FF7B96921CC967B00A7DD74 /* LegacyIPAddressRange.swift */,
-                               5FF7B96C21CC967B00A7DD74 /* LegacyPeerConfiguration.swift */,
-                               5FF7B96D21CC967B00A7DD74 /* LegacyTunnelConfiguration.swift */,
-                       );
-                       path = Legacy;
-                       sourceTree = "<group>";
-               };
                6F5D0C1B218352EF000F85AD /* WireGuardNetworkExtension */ = {
                        isa = PBXGroup;
                        children = (
                                6F7774E6217201E0006A79B3 /* Model */,
                                6FFA5D942194454A0001E2F7 /* NETunnelProviderProtocol+Extension.swift */,
                                6F5A2B4421AFDE020081EDD8 /* FileManager+Extension.swift */,
+                               5F9696A921CD6AE6008063FE /* LegacyConfigMigration.swift */,
                        );
                        path = Shared;
                        sourceTree = "<group>";
                6F7774E6217201E0006A79B3 /* Model */ = {
                        isa = PBXGroup;
                        children = (
-                               5FF7B96721CC966300A7DD74 /* Legacy */,
                                6F7774E72172020C006A79B3 /* TunnelConfiguration.swift */,
                                6F7774E9217229DB006A79B3 /* IPAddressRange.swift */,
                                6F693A552179E556008551C1 /* Endpoint.swift */,
                                6FF3527121C240160008484E /* Logger.swift in Sources */,
                                6F5A2B4621AFDED40081EDD8 /* FileManager+Extension.swift in Sources */,
                                6FFA5DA021958ECC0001E2F7 /* ErrorNotifier.swift in Sources */,
-                               5FF7B97521CC967B00A7DD74 /* LegacyDNSServer.swift in Sources */,
                                6FFA5D96219446380001E2F7 /* NETunnelProviderProtocol+Extension.swift in Sources */,
-                               5FF7B97921CC967B00A7DD74 /* LegacyTunnelConfiguration.swift in Sources */,
                                6FFA5D8E2194370D0001E2F7 /* TunnelConfiguration.swift in Sources */,
-                               5FF7B97721CC967B00A7DD74 /* LegacyPeerConfiguration.swift in Sources */,
                                5FF7B96621CC95FA00A7DD74 /* PeerConfiguration.swift in Sources */,
                                6FFA5D8F2194370D0001E2F7 /* IPAddressRange.swift in Sources */,
                                6FFA5D902194370D0001E2F7 /* Endpoint.swift in Sources */,
                                5FF7B96321CC95DE00A7DD74 /* InterfaceConfiguration.swift in Sources */,
                                6FFA5D9321943BC90001E2F7 /* DNSResolver.swift in Sources */,
-                               5FF7B97121CC967B00A7DD74 /* LegacyIPAddressRange.swift in Sources */,
-                               5FF7B96F21CC967B00A7DD74 /* LegacyInterfaceConfiguration.swift in Sources */,
                                6FFA5D912194370D0001E2F7 /* DNSServer.swift in Sources */,
+                               5F9696AB21CD6AE6008063FE /* LegacyConfigMigration.swift in Sources */,
                                6FFA5D8921942F320001E2F7 /* PacketTunnelSettingsGenerator.swift in Sources */,
-                               5FF7B97321CC967B00A7DD74 /* LegacyEndpoint.swift in Sources */,
                                6F5D0C1D218352EF000F85AD /* PacketTunnelProvider.swift in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                                6F7774E421718281006A79B3 /* TunnelsListTableViewController.swift in Sources */,
                                6F7774EF21722D97006A79B3 /* TunnelsManager.swift in Sources */,
                                5F45417D21C1B23600994C13 /* UITableViewCell+Reuse.swift in Sources */,
-                               5FF7B97821CC967B00A7DD74 /* LegacyTunnelConfiguration.swift in Sources */,
                                5F45419221C2D55800994C13 /* CheckmarkCell.swift in Sources */,
-                               5FF7B97221CC967B00A7DD74 /* LegacyEndpoint.swift in Sources */,
                                6FE254FF219C60290028284D /* ZipExporter.swift in Sources */,
                                6F693A562179E556008551C1 /* Endpoint.swift in Sources */,
                                6FDEF7E62185EFB200D8FBF6 /* QRScanViewController.swift in Sources */,
                                6FFA5D952194454A0001E2F7 /* NETunnelProviderProtocol+Extension.swift in Sources */,
-                               5FF7B97021CC967B00A7DD74 /* LegacyIPAddressRange.swift in Sources */,
                                5FF7B96221CC95DE00A7DD74 /* InterfaceConfiguration.swift in Sources */,
                                5F4541A921C451D100994C13 /* TunnelStatus.swift in Sources */,
-                               5FF7B96E21CC967B00A7DD74 /* LegacyInterfaceConfiguration.swift in Sources */,
                                6F61F1E921B932F700483816 /* WireGuardAppError.swift in Sources */,
                                6F6899A62180447E0012E523 /* x25519.c in Sources */,
                                6F7774E2217181B1006A79B3 /* AppDelegate.swift in Sources */,
                                5F4541A621C4449E00994C13 /* ButtonCell.swift in Sources */,
                                5F45419821C2D60500994C13 /* KeyValueCell.swift in Sources */,
                                6F919EC3218A2AE90023B400 /* ErrorPresenter.swift in Sources */,
+                               5F9696AA21CD6AE6008063FE /* LegacyConfigMigration.swift in Sources */,
                                6F5A2B4821AFF49A0081EDD8 /* FileManager+Extension.swift in Sources */,
                                5F45418C21C2D48200994C13 /* TunnelEditKeyValueCell.swift in Sources */,
                                6FDEF8082187442100D8FBF6 /* WgQuickConfigFileWriter.swift in Sources */,
                                6FE254FB219C10800028284D /* ZipImporter.swift in Sources */,
                                6F7774EA217229DB006A79B3 /* IPAddressRange.swift in Sources */,
-                               5FF7B97621CC967B00A7DD74 /* LegacyPeerConfiguration.swift in Sources */,
                                5F4541AE21C7704300994C13 /* NEVPNStatus+CustomStringConvertible.swift in Sources */,
                                6F7774E82172020C006A79B3 /* TunnelConfiguration.swift in Sources */,
-                               5FF7B97421CC967B00A7DD74 /* LegacyDNSServer.swift in Sources */,
                                6FDEF7FB21863B6100D8FBF6 /* unzip.c in Sources */,
                                6F6899A8218044FC0012E523 /* Curve25519.swift in Sources */,
                                5F4541A021C2D6B700994C13 /* TunnelListCell.swift in Sources */,