mirror of
https://github.com/passepartoutvpn/wireguard-apple.git
synced 2025-02-14 20:02:02 +00:00
33 lines
1.0 KiB
Swift
33 lines
1.0 KiB
Swift
// 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.
|
|
}
|
|
}
|