diff options
Diffstat (limited to 'WireGuard/Shared/Model/PeerConfiguration.swift')
-rw-r--r-- | WireGuard/Shared/Model/PeerConfiguration.swift | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/WireGuard/Shared/Model/PeerConfiguration.swift b/WireGuard/Shared/Model/PeerConfiguration.swift index 2e969e6..a684fa6 100644 --- a/WireGuard/Shared/Model/PeerConfiguration.swift +++ b/WireGuard/Shared/Model/PeerConfiguration.swift @@ -25,3 +25,24 @@ struct PeerConfiguration { } } } + +extension PeerConfiguration: Equatable { + static func == (lhs: PeerConfiguration, rhs: PeerConfiguration) -> Bool { + return lhs.publicKey == rhs.publicKey && + lhs.preSharedKey == rhs.preSharedKey && + Set(lhs.allowedIPs) == Set(rhs.allowedIPs) && + lhs.endpoint == rhs.endpoint && + lhs.persistentKeepAlive == rhs.persistentKeepAlive + } +} + +extension PeerConfiguration: Hashable { + func hash(into hasher: inout Hasher) { + hasher.combine(publicKey) + hasher.combine(preSharedKey) + hasher.combine(Set(allowedIPs)) + hasher.combine(endpoint) + hasher.combine(persistentKeepAlive) + + } +} |