mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-01-08 09:42:47 +00:00
12e33681c1
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
33 lines
1.1 KiB
Swift
33 lines
1.1 KiB
Swift
//
|
|
// Copyright © 2018 WireGuard LLC. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
import NetworkExtension
|
|
|
|
extension AppCoordinator: TunnelInfoTableViewControllerDelegate {
|
|
func connect(tunnel: Tunnel, tunnelInfoTableViewController: TunnelInfoTableViewController) {
|
|
connect(tunnel: tunnel)
|
|
}
|
|
|
|
func disconnect(tunnel: Tunnel, tunnelInfoTableViewController: TunnelInfoTableViewController) {
|
|
disconnect(tunnel: tunnel)
|
|
}
|
|
|
|
func status(for tunnel: Tunnel, tunnelInfoTableViewController: TunnelInfoTableViewController) -> NEVPNStatus {
|
|
let session = self.providerManager(for: tunnel)?.connection as? NETunnelProviderSession
|
|
return session?.status ?? .invalid
|
|
}
|
|
|
|
func configure(tunnel: Tunnel, tunnelInfoTableViewController: TunnelInfoTableViewController) {
|
|
let editContext = persistentContainer.newBackgroundContext()
|
|
var backgroundTunnel: Tunnel?
|
|
editContext.performAndWait {
|
|
backgroundTunnel = editContext.object(with: tunnel.objectID) as? Tunnel
|
|
}
|
|
|
|
showTunnelConfigurationViewController(tunnel: backgroundTunnel, context: editContext)
|
|
}
|
|
|
|
}
|