diff --git a/Demo/Demo/iOS/OpenVPNViewController.swift b/Demo/Demo/iOS/OpenVPNViewController.swift index f213fa2..75327da 100644 --- a/Demo/Demo/iOS/OpenVPNViewController.swift +++ b/Demo/Demo/iOS/OpenVPNViewController.swift @@ -80,7 +80,9 @@ class OpenVPNViewController: UIViewController { object: nil ) - vpn.prepare() + Task { + await vpn.prepare() + } // testFetchRef() } @@ -123,14 +125,16 @@ class OpenVPNViewController: UIViewController { return } - var extra = NetworkExtensionExtra() - extra.passwordReference = passwordReference - vpn.reconnect( - tunnelIdentifier, - configuration: cfg!, - extra: extra, - after: .seconds(2) - ) + Task { + var extra = NetworkExtensionExtra() + extra.passwordReference = passwordReference + try await vpn.reconnect( + tunnelIdentifier, + configuration: cfg!, + extra: extra, + after: .seconds(2) + ) + } } func disconnect() { diff --git a/Demo/Demo/macOS/OpenVPNViewController.swift b/Demo/Demo/macOS/OpenVPNViewController.swift index 93e4365..f8d6401 100644 --- a/Demo/Demo/macOS/OpenVPNViewController.swift +++ b/Demo/Demo/macOS/OpenVPNViewController.swift @@ -75,7 +75,9 @@ class OpenVPNViewController: NSViewController { object: nil ) - vpn.prepare() + Task { + await vpn.prepare() + } // testFetchRef() } @@ -114,18 +116,22 @@ class OpenVPNViewController: NSViewController { return } - var extra = NetworkExtensionExtra() - extra.passwordReference = passwordReference - vpn.reconnect( - tunnelIdentifier, - configuration: cfg!, - extra: extra, - after: .seconds(2) - ) + Task { + var extra = NetworkExtensionExtra() + extra.passwordReference = passwordReference + try await vpn.reconnect( + tunnelIdentifier, + configuration: cfg!, + extra: extra, + after: .seconds(2) + ) + } } func disconnect() { - vpn.disconnect() + Task { + await vpn.disconnect() + } } func updateButton() { diff --git a/Demo/Demo/macOS/WireGuardViewController.swift b/Demo/Demo/macOS/WireGuardViewController.swift index f6013b2..fe70764 100644 --- a/Demo/Demo/macOS/WireGuardViewController.swift +++ b/Demo/Demo/macOS/WireGuardViewController.swift @@ -72,7 +72,9 @@ class WireGuardViewController: NSViewController { object: nil ) - vpn.prepare() + Task { + await vpn.prepare() + } } @IBAction func connectionClicked(_ sender: Any) { @@ -105,16 +107,20 @@ class WireGuardViewController: NSViewController { return } - vpn.reconnect( - tunnelIdentifier, - configuration: cfg, - extra: nil, - after: .seconds(2) - ) + Task { + try await vpn.reconnect( + tunnelIdentifier, + configuration: cfg, + extra: nil, + after: .seconds(2) + ) + } } func disconnect() { - vpn.disconnect() + Task { + await vpn.disconnect() + } } func updateButton() {