Model: Name should be part of the interface, not the tunnel

Signed-off-by: Roopesh Chander <roop@roopc.net>
This commit is contained in:
Roopesh Chander 2018-10-17 16:11:22 +05:30
parent 6de354b4c5
commit 921b81e89b
2 changed files with 5 additions and 5 deletions

View File

@ -10,23 +10,23 @@ import Foundation
@available(OSX 10.14, iOS 12.0, *)
class TunnelConfiguration: Codable {
var name: String
let interface: InterfaceConfiguration
var peers: [PeerConfiguration] = []
init(name: String, interface: InterfaceConfiguration) {
self.name = name
init(interface: InterfaceConfiguration) {
self.interface = interface
}
}
@available(OSX 10.14, iOS 12.0, *)
class InterfaceConfiguration: Codable {
var name: String
var privateKey: Data
var addresses: [IPAddressRange] = []
var listenPort: UInt64? = nil
var mtu: UInt64? = nil
var dns: String? = nil
init(privateKey: Data) {
init(name: String, privateKey: Data) {
self.name = name
self.privateKey = privateKey
}
}

View File

@ -13,7 +13,7 @@ class TunnelProviderManager {
var name: String
var tunnelConfiguration: TunnelConfiguration
init(tunnelConfiguration: TunnelConfiguration) {
self.name = tunnelConfiguration.name
self.name = tunnelConfiguration.interface.name
self.tunnelConfiguration = tunnelConfiguration
}
}