aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Shared/Model/IPAddressRange.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/Shared/Model/IPAddressRange.swift')
-rw-r--r--WireGuard/Shared/Model/IPAddressRange.swift13
1 files changed, 13 insertions, 0 deletions
diff --git a/WireGuard/Shared/Model/IPAddressRange.swift b/WireGuard/Shared/Model/IPAddressRange.swift
index 7d3e5eca..26dccc34 100644
--- a/WireGuard/Shared/Model/IPAddressRange.swift
+++ b/WireGuard/Shared/Model/IPAddressRange.swift
@@ -14,6 +14,19 @@ struct IPAddressRange {
}
}
+extension IPAddressRange: Equatable {
+ static func == (lhs: IPAddressRange, rhs: IPAddressRange) -> Bool {
+ return lhs.address.rawValue == rhs.address.rawValue && lhs.networkPrefixLength == rhs.networkPrefixLength
+ }
+}
+
+extension IPAddressRange: Hashable {
+ func hash(into hasher: inout Hasher) {
+ hasher.combine(address.rawValue)
+ hasher.combine(networkPrefixLength)
+ }
+}
+
extension IPAddressRange {
var stringRepresentation: String {
return "\(address)/\(networkPrefixLength)"