aboutsummaryrefslogtreecommitdiffstats
path: root/WireGuard/Shared/Model/PeerConfiguration.swift
diff options
context:
space:
mode:
Diffstat (limited to 'WireGuard/Shared/Model/PeerConfiguration.swift')
-rw-r--r--WireGuard/Shared/Model/PeerConfiguration.swift51
1 files changed, 0 insertions, 51 deletions
diff --git a/WireGuard/Shared/Model/PeerConfiguration.swift b/WireGuard/Shared/Model/PeerConfiguration.swift
deleted file mode 100644
index 7fd3f87..0000000
--- a/WireGuard/Shared/Model/PeerConfiguration.swift
+++ /dev/null
@@ -1,51 +0,0 @@
-// SPDX-License-Identifier: MIT
-// Copyright © 2018-2019 WireGuard LLC. All Rights Reserved.
-
-import Foundation
-
-struct PeerConfiguration {
- var publicKey: Data
- var preSharedKey: Data? {
- didSet(value) {
- if let value = value {
- if value.count != TunnelConfiguration.keyLength {
- fatalError("Invalid preshared key")
- }
- }
- }
- }
- var allowedIPs = [IPAddressRange]()
- var endpoint: Endpoint?
- var persistentKeepAlive: UInt16?
- var rxBytes: UInt64?
- var txBytes: UInt64?
- var lastHandshakeTime: Date?
-
- init(publicKey: Data) {
- self.publicKey = publicKey
- if publicKey.count != TunnelConfiguration.keyLength {
- fatalError("Invalid public key")
- }
- }
-}
-
-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)
-
- }
-}