wireguard-apple/WireGuard/Coordinators/AppCoordinator+TunnelInfoTableViewControllerDelegate.swift
Jeroen Leenarts 12e33681c1 Remove a few prints, add some whitespace.
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
2018-10-02 22:36:39 +02:00

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)
}
}