From 23d15e3d170ee2cff2ecd3bf2e68c9c657288873 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Wed, 15 Apr 2026 11:36:07 +0800 Subject: [PATCH] fix --- Tun/PacketTunnelProvider.swift | 8 +------- .../{Core => AppEventCenter}/SDLNotificationCenter.swift | 1 - .../{Core => AppEventCenter}/SDLTunnelAppEventStore.swift | 0 3 files changed, 1 insertion(+), 8 deletions(-) rename punchnet/{Core => AppEventCenter}/SDLNotificationCenter.swift (96%) rename punchnet/{Core => AppEventCenter}/SDLTunnelAppEventStore.swift (100%) diff --git a/Tun/PacketTunnelProvider.swift b/Tun/PacketTunnelProvider.swift index 9960772..0cf719a 100644 --- a/Tun/PacketTunnelProvider.swift +++ b/Tun/PacketTunnelProvider.swift @@ -17,14 +17,8 @@ class PacketTunnelProvider: NEPacketTunnelProvider { private var rootTask: Task? 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 diff --git a/punchnet/Core/SDLNotificationCenter.swift b/punchnet/AppEventCenter/SDLNotificationCenter.swift similarity index 96% rename from punchnet/Core/SDLNotificationCenter.swift rename to punchnet/AppEventCenter/SDLNotificationCenter.swift index a94cda7..46c412d 100644 --- a/punchnet/Core/SDLNotificationCenter.swift +++ b/punchnet/AppEventCenter/SDLNotificationCenter.swift @@ -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") } diff --git a/punchnet/Core/SDLTunnelAppEventStore.swift b/punchnet/AppEventCenter/SDLTunnelAppEventStore.swift similarity index 100% rename from punchnet/Core/SDLTunnelAppEventStore.swift rename to punchnet/AppEventCenter/SDLTunnelAppEventStore.swift