diff options
author | Eric Kuck <eric@bluelinelabs.com> | 2018-12-14 17:12:59 -0600 |
---|---|---|
committer | Eric Kuck <eric@bluelinelabs.com> | 2018-12-14 17:15:22 -0600 |
commit | 7a24f18eb753180800f9b44a767b0d59e4e702b7 (patch) | |
tree | 0e02b3ff59a672b0b25eb7bcc195e23730abec40 /WireGuard/WireGuard/Tunnel/TunnelStatus.swift | |
parent | Prettier log time format (diff) | |
download | wireguard-apple-7a24f18eb753180800f9b44a767b0d59e4e702b7.tar.xz wireguard-apple-7a24f18eb753180800f9b44a767b0d59e4e702b7.zip |
Most similar views now shared between ViewControllers
Signed-off-by: Eric Kuck <eric@bluelinelabs.com>
Diffstat (limited to '')
-rw-r--r-- | WireGuard/WireGuard/Tunnel/TunnelStatus.swift | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/WireGuard/WireGuard/Tunnel/TunnelStatus.swift b/WireGuard/WireGuard/Tunnel/TunnelStatus.swift new file mode 100644 index 0000000..9f03417 --- /dev/null +++ b/WireGuard/WireGuard/Tunnel/TunnelStatus.swift @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2018 WireGuard LLC. All Rights Reserved. + +import Foundation +import NetworkExtension + +@objc enum TunnelStatus: Int { + case inactive + case activating + case active + case deactivating + case reasserting // Not a possible state at present + case restarting // Restarting tunnel (done after saving modifications to an active tunnel) + case waiting // Waiting for another tunnel to be brought down + + init(from systemStatus: NEVPNStatus) { + switch systemStatus { + case .connected: + self = .active + case .connecting: + self = .activating + case .disconnected: + self = .inactive + case .disconnecting: + self = .deactivating + case .reasserting: + self = .reasserting + case .invalid: + self = .inactive + } + } +} + +extension TunnelStatus: CustomDebugStringConvertible { + public var debugDescription: String { + switch self { + case .inactive: return "inactive" + case .activating: return "activating" + case .active: return "active" + case .deactivating: return "deactivating" + case .reasserting: return "reasserting" + case .restarting: return "restarting" + case .waiting: return "waiting" + } + } +} |