aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard
diff options
context:
space:
mode:
authorRoopesh Chander <roop@roopc.net>2019-02-16 00:31:28 +0530
committerRoopesh Chander <roop@roopc.net>2019-02-16 01:20:11 +0530
commit4c88f477a2a5bc83b229f3c95ec46a385d45c6eb (patch)
tree1850948cfa9ab2aee941cd091046cec5bbbc7225 /WireGuard
parentConfTextStorage: Make fieldType an enum (diff)
downloadwireguard-apple-4c88f477a2a5bc83b229f3c95ec46a385d45c6eb.tar.xz
wireguard-apple-4c88f477a2a5bc83b229f3c95ec46a385d45c6eb.zip
ConfTextStorage: Let's keep the AllowedIPs and DNS servers as strings
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard')
-rw-r--r--WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift12
1 files changed, 4 insertions, 8 deletions
diff --git a/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift b/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
index 48a32edf..caa2bc44 100644
--- a/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
+++ b/WireGuard/WireGuard/UI/macOS/View/ConfTextStorage.swift
@@ -17,8 +17,8 @@ class ConfTextStorage: NSTextStorage {
private(set) var privateKeyString: String?
private(set) var hasOnePeer: Bool = false
- private(set) var lastOnePeerAllowedIPs: [IPAddressRange] = []
- private(set) var lastOnePeerDNSServers: [DNSServer] = []
+ private(set) var lastOnePeerAllowedIPs = [String]()
+ private(set) var lastOnePeerDNSServers = [String]()
override init() {
backingStore = NSMutableAttributedString(string: "")
@@ -117,9 +117,7 @@ class ConfTextStorage: NSTextStorage {
} else if span.type == HighlightField {
fieldType = FieldType(rawValue: substring.lowercased())
} else if span.type == HighlightIP && fieldType == .dns {
- if let parsed = DNSServer(from: substring) {
- lastOnePeerDNSServers.append(parsed)
- }
+ lastOnePeerDNSServers.append(substring)
} else if span.type == HighlightIP && fieldType == .allowedips {
let next = spans.successor()
let nextnext = next.successor()
@@ -127,9 +125,7 @@ class ConfTextStorage: NSTextStorage {
substring += backingStore.attributedSubstring(from: NSRange(location: next.pointee.start, length: next.pointee.len)).string +
backingStore.attributedSubstring(from: NSRange(location: nextnext.pointee.start, length: nextnext.pointee.len)).string
}
- if let parsed = IPAddressRange(from: substring) {
- lastOnePeerAllowedIPs.append(parsed)
- }
+ lastOnePeerAllowedIPs.append(substring)
}
spans = spans.successor()
}