From d3a9e7914909fc0306921fde5ff9e215c22b6a56 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Thu, 25 Oct 2018 07:03:24 +0530 Subject: [PATCH] Parser: Interface name can be added after parsing --- WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift b/WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift index b2688e3..5d06969 100644 --- a/WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift +++ b/WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift @@ -21,15 +21,13 @@ class WgQuickConfigFileParser { // Based on the parser written by Eric Kuck in commit 5ef1656 - static func parse(_ text: String, name: String) throws -> TunnelConfiguration { - - assert(!name.isEmpty) + static func parse(_ text: String) throws -> TunnelConfiguration { func collate(interfaceAttributes attributes: [String:String]) -> InterfaceConfiguration? { // required wg fields guard let privateKeyString = attributes["PrivateKey"] else { return nil } guard let privateKey = Data(base64Encoded: privateKeyString), privateKey.count == 32 else { return nil } - var interface = InterfaceConfiguration(name: name, privateKey: privateKey) + var interface = InterfaceConfiguration(name: "", privateKey: privateKey) // other wg fields if let listenPortString = attributes["ListenPort"] { guard let listenPort = UInt16(listenPortString) else { return nil }