diff options
author | 2018-11-05 23:52:16 +0530 | |
---|---|---|
committer | 2018-11-05 23:53:00 +0530 | |
commit | 34a8d70a45e42a5e4afdcda178b4f32b1df017af (patch) | |
tree | 33b3efe5f1c696f04214d2fdec89917a0068b2c0 | |
parent | QR Code: Dismiss the QR code screen when the name prompt is cancelled (diff) | |
download | wireguard-apple-34a8d70a45e42a5e4afdcda178b4f32b1df017af.tar.xz wireguard-apple-34a8d70a45e42a5e4afdcda178b4f32b1df017af.zip |
Parser: Address, DNS and AllowedIPs can have mutliple entries
Signed-off-by: Roopesh Chander <roop@roopc.net>
-rw-r--r-- | WireGuard/WireGuard/ConfigFile/WgQuickConfigFileParser.swift | 7 |
1 files changed, 6 insertions, 1 deletions
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[..<equalsIndex].trimmingCharacters(in: .whitespaces) let value = line[line.index(equalsIndex, offsetBy: 1)...].trimmingCharacters(in: .whitespaces) - attributes[key] = value + let keysWithMultipleEntriesAllowed: Set<String> = ["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) |