From 34a8d70a45e42a5e4afdcda178b4f32b1df017af Mon Sep 17 00:00:00 2001 From: Roopesh Chander Date: Mon, 5 Nov 2018 23:52:16 +0530 Subject: Parser: Address, DNS and AllowedIPs can have mutliple entries Signed-off-by: Roopesh Chander --- WireGuard/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) -- cgit v1.2.3-59-g8ed1b