diff options
author | Roopesh Chander <roop@roopc.net> | 2018-10-28 21:57:18 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2018-10-28 21:57:18 +0530 |
commit | 4855eafb393e3347b47a0002e455856c0a817e12 (patch) | |
tree | e9526da9d40d890ea13493757b76939021d795de /WireGuard/WireGuard | |
parent | QR code: Ability to add tunnels with a QR code scan (diff) | |
download | wireguard-apple-4855eafb393e3347b47a0002e455856c0a817e12.tar.xz wireguard-apple-4855eafb393e3347b47a0002e455856c0a817e12.zip |
Revert "Parser: Interface name can be added after parsing"
This reverts commit d3a9e7914909fc0306921fde5ff9e215c22b6a56.
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuard')
-rw-r--r-- | WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift b/WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift index 5d06969..b2688e3 100644 --- a/WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift +++ b/WireGuard/WireGuard/Parsing/WgQuickConfigFileParser.swift @@ -21,13 +21,15 @@ class WgQuickConfigFileParser { // Based on the parser written by Eric Kuck <eric@bluelinelabs.com> in commit 5ef1656 - static func parse(_ text: String) throws -> TunnelConfiguration { + static func parse(_ text: String, name: String) throws -> TunnelConfiguration { + + assert(!name.isEmpty) 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: "", privateKey: privateKey) + var interface = InterfaceConfiguration(name: name, privateKey: privateKey) // other wg fields if let listenPortString = attributes["ListenPort"] { guard let listenPort = UInt16(listenPortString) else { return nil } |