diff --git a/client/macos/Runner.xcodeproj/project.pbxproj b/client/macos/Runner.xcodeproj/project.pbxproj index adee338..f53522e 100644 --- a/client/macos/Runner.xcodeproj/project.pbxproj +++ b/client/macos/Runner.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ A17B79FC2FE526F5001ABF28 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A17B79FB2FE526F5001ABF28 /* SystemConfiguration.framework */; }; A17B79FE2FE52708001ABF28 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A17B79FD2FE52708001ABF28 /* AppKit.framework */; }; A17B7A002FE52723001ABF28 /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = A17B79FF2FE52715001ABF28 /* libresolv.tbd */; }; + A17B7A072FE52A10001ABF28 /* VpnChannel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A17B7A062FE52A10001ABF28 /* VpnChannel.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -127,6 +128,7 @@ A17B79FB2FE526F5001ABF28 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; A17B79FD2FE52708001ABF28 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; A17B79FF2FE52715001ABF28 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = usr/lib/libresolv.tbd; sourceTree = SDKROOT; }; + A17B7A062FE52A10001ABF28 /* VpnChannel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VpnChannel.swift; sourceTree = ""; }; B21E68FC1F5D33DD67A0DF5E /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; C55C525CAAF7B3313B74AC65 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; C57BBFD43F9175D1E23685EF /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; @@ -249,6 +251,7 @@ 33FAB671232836740065AC1E /* Runner */ = { isa = PBXGroup; children = ( + A17B7A062FE52A10001ABF28 /* VpnChannel.swift */, 33CC10F02044A3C60003C045 /* AppDelegate.swift */, 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */, 33E51913231747F40026EE4D /* DebugProfile.entitlements */, @@ -561,6 +564,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + A17B7A072FE52A10001ABF28 /* VpnChannel.swift in Sources */, 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */, 33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */, 335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */, diff --git a/client/macos/Runner/VpnChannel.swift b/client/macos/Runner/VpnChannel.swift index e36ae2f..4057510 100644 --- a/client/macos/Runner/VpnChannel.swift +++ b/client/macos/Runner/VpnChannel.swift @@ -12,10 +12,9 @@ import FlutterMacOS import NetworkExtension -import SystemExtensions -import os -private let log = Logger(subsystem: "com.pangolin.pangolin", category: "vpn") +// NSLog 兼容老部署目标(Runner < macOS 11,os.Logger 不可用)。 +private func vpnLog(_ message: String) { NSLog("[pangolin/vpn] %@", message) } final class VpnChannel: NSObject { private static let tunnelBundleId = "com.pangolin.pangolin.PacketTunnel" @@ -76,7 +75,7 @@ final class VpnChannel: NSObject { ]) result(nil) } catch { - log.error("start failed: \(error.localizedDescription)") + vpnLog("start failed: \(error.localizedDescription)") result(FlutterError(code: "start_failed", message: error.localizedDescription, details: nil)) } }