From 4c701a0e4faef6b0e29cb0d2402258316270dc92 Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Mon, 5 Nov 2018 23:52:16 +0530 Subject: [PATCH] Parser: Address, DNS and AllowedIPs can have mutliple entries --- .../WireGuard/ConfigFile/WgQuickConfigFileParser.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift b/WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift index 2b4ca0b..869d94e 100644 --- a/WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift +++ b/WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift @@ -114,7 +114,12 @@ class WgQuickConfigFileParser { // Line contains an attribute let key = line[.. = ["Address", "AllowedIPs", "DNS"] + if let presentValue = attributes[key], keysWithMultipleEntriesAllowed.contains(key) { + attributes[key] = presentValue + "," + value + } else { + attributes[key] = value + } } else { if (lowercasedLine != "[interface]" && lowercasedLine != "[peer]") { throw ParseError.invalidLine(line)