From 921b81e89b2f395347510215d30255258fa9f2e3 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Wed, 17 Oct 2018 16:11:22 +0530 Subject: [PATCH] Model: Name should be part of the interface, not the tunnel Signed-off-by: Roopesh Chander --- WireGuard/WireGuard/Model/Configuration.swift | 8 ++++---- WireGuard/WireGuard/VPN/TunnelsManager.swift | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/WireGuard/WireGuard/Model/Configuration.swift b/WireGuard/WireGuard/Model/Configuration.swift index 4eb3f2f..ab50cf7 100644 --- a/WireGuard/WireGuard/Model/Configuration.swift +++ b/WireGuard/WireGuard/Model/Configuration.swift @@ -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 } } diff --git a/WireGuard/WireGuard/VPN/TunnelsManager.swift b/WireGuard/WireGuard/VPN/TunnelsManager.swift index ff1cf78..ecc64d0 100644 --- a/WireGuard/WireGuard/VPN/TunnelsManager.swift +++ b/WireGuard/WireGuard/VPN/TunnelsManager.swift @@ -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 } }