wireguard-apple/WireGuardNetworkExtension/PacketTunnelProvider.swift

39 lines
1.1 KiB
Swift
Raw Normal View History

//
// PacketTunnelProvider.swift
// WireGuardNetworkExtension
//
// Created by Jeroen Leenarts on 19-06-18.
// Copyright © 2018 WireGuard. 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.
}
}