diff options
author | Roopesh Chander <roop@roopc.net> | 2018-12-27 15:44:49 +0530 |
---|---|---|
committer | Roopesh Chander <roop@roopc.net> | 2019-01-14 14:52:27 +0530 |
commit | 573f9640deb93cb0b9afa6662adc58be236431c4 (patch) | |
tree | e8cc768268f49ea5b0601d230788308c22248eac /WireGuard/WireGuardNetworkExtensionmacOS/PacketTunnelProvider.swift | |
parent | macOS: Add WireGuardmacOS target (diff) | |
download | wireguard-apple-573f9640deb93cb0b9afa6662adc58be236431c4.tar.xz wireguard-apple-573f9640deb93cb0b9afa6662adc58be236431c4.zip |
macOS: Add WireGuardNetworkExtensionmacOS target
Signed-off-by: Roopesh Chander <roop@roopc.net>
Diffstat (limited to 'WireGuard/WireGuardNetworkExtensionmacOS/PacketTunnelProvider.swift')
-rw-r--r-- | WireGuard/WireGuardNetworkExtensionmacOS/PacketTunnelProvider.swift | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/WireGuard/WireGuardNetworkExtensionmacOS/PacketTunnelProvider.swift b/WireGuard/WireGuardNetworkExtensionmacOS/PacketTunnelProvider.swift new file mode 100644 index 0000000..6d3b21a --- /dev/null +++ b/WireGuard/WireGuardNetworkExtensionmacOS/PacketTunnelProvider.swift @@ -0,0 +1,32 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2018 WireGuard LLC. All Rights Reserved. + +import NetworkExtension + +class PacketTunnelProvider: NEPacketTunnelProvider { + + override func startTunnel(options: [String : NSObject]?, completionHandler: @escaping (Error?) -> Void) { + // Add code here to start the process of connecting the tunnel. + } + + override func stopTunnel(with reason: NEProviderStopReason, completionHandler: @escaping () -> Void) { + // Add code here to start the process of stopping the tunnel. + completionHandler() + } + + override func handleAppMessage(_ messageData: Data, completionHandler: ((Data?) -> Void)?) { + // Add code here to handle the message. + if let handler = completionHandler { + handler(messageData) + } + } + + override func sleep(completionHandler: @escaping () -> Void) { + // Add code here to get ready to sleep. + completionHandler() + } + + override func wake() { + // Add code here to wake up. + } +} |