aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Shared/Model/InterfaceConfiguration.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/Shared/Model/InterfaceConfiguration.swift')
-rw-r--r--WireGuard/Shared/Model/InterfaceConfiguration.swift14
1 files changed, 14 insertions, 0 deletions
diff --git a/WireGuard/Shared/Model/InterfaceConfiguration.swift b/WireGuard/Shared/Model/InterfaceConfiguration.swift
index ef33907a..e28046b4 100644
--- a/WireGuard/Shared/Model/InterfaceConfiguration.swift
+++ b/WireGuard/Shared/Model/InterfaceConfiguration.swift
@@ -2,6 +2,7 @@
// Copyright © 2018 WireGuard LLC. All Rights Reserved.
import Foundation
+import Network
struct InterfaceConfiguration {
var privateKey: Data
@@ -17,3 +18,16 @@ struct InterfaceConfiguration {
self.privateKey = privateKey
}
}
+
+extension InterfaceConfiguration: Equatable {
+ static func == (lhs: InterfaceConfiguration, rhs: InterfaceConfiguration) -> Bool {
+ let lhsAddresses = lhs.addresses.filter { $0.address is IPv4Address } + lhs.addresses.filter { $0.address is IPv6Address }
+ let rhsAddresses = rhs.addresses.filter { $0.address is IPv4Address } + rhs.addresses.filter { $0.address is IPv6Address }
+
+ return lhs.privateKey == rhs.privateKey &&
+ lhsAddresses == rhsAddresses &&
+ lhs.listenPort == rhs.listenPort &&
+ lhs.mtu == rhs.mtu &&
+ lhs.dns == rhs.dns
+ }
+}