aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Shared/Model/Legacy/LegacyInterfaceConfiguration.swift
blob: 680c8d74cd918d408eebc5be2d56e68e40c0d1b8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// 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
    }
}