This commit is contained in:
anlicheng 2026-04-15 11:36:07 +08:00
parent 739acd3938
commit 23d15e3d17
3 changed files with 1 additions and 8 deletions

View File

@ -17,14 +17,8 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
private var rootTask: Task<Void, Error>?
override func startTunnel(options: [String: NSObject]?, completionHandler: @escaping (Error?) -> Void) {
let shared = UserDefaults(suiteName: "group.com.jihe.punchnetmac")
let msg = shared?.string(forKey: "test_msg")
SDLLogger.log("NE read message: \(msg ?? "failed")", for: .debug)
SDLTunnelAppNotifier.shared.clear()
SDLNotificationCenter.shared.post(.vpnStatusChanged)
//
guard self.contextActor == nil else {
completionHandler(TunnelError.invalidContext)
@ -75,7 +69,7 @@ class PacketTunnelProvider: NEPacketTunnelProvider {
reply.code = 0
reply.message = "操作成功"
completionHandler?(try reply.serializedData())
} catch let err {
var reply = NEReply()
reply.code = 1

View File

@ -17,7 +17,6 @@ public struct DarwinNotificationName: RawRepresentable, Hashable {
//
extension DarwinNotificationName {
static let vpnStatusChanged = DarwinNotificationName(rawValue: "com.jihe.punchnetmac.vpnStatusChanged")
static let tunnelEventChanged = DarwinNotificationName(rawValue: "com.jihe.punchnetmac.tunnelEventChanged")
}