Initialize Packet Tunnel + Config

This commit is contained in:
GFWFighter
2023-10-16 20:43:42 +03:30
parent 17a3ed434b
commit 7b2129ad6d
18 changed files with 717 additions and 81 deletions

View File

@@ -0,0 +1,36 @@
//
// PacketTunnelProvider.swift
// SingBoxPacketTunnel
//
// Created by GFWFighter on 7/24/1402 AP.
//
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.
}
}