From 2c05d71dbe3684e51e9de55910619156ebe360c6 Mon Sep 17 00:00:00 2001 From: anlicheng <244108715@qq.com> Date: Sun, 3 Aug 2025 23:26:30 +0800 Subject: [PATCH] add macos --- Package.swift | 8 ++++---- Sources/Punchnet/SDLContext.swift | 7 +------ Sources/Punchnet/SDLNatProber.swift | 1 + Sources/Punchnet/SDLNoticeClient.swift | 1 + Sources/Punchnet/SDLSuperClient.swift | 1 + Sources/Punchnet/SDLUDPHole.swift | 1 + 6 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Package.swift b/Package.swift index c8660fb..e0c8354 100644 --- a/Package.swift +++ b/Package.swift @@ -5,10 +5,10 @@ import PackageDescription let package = Package( name: "sdlan", -// platforms: [ -// .iOS(.v17), -// .macOS(.v14) -// ], + platforms: [ + .iOS(.v17), + .macOS(.v14) + ], products: [ // Products define the executables and libraries a package produces, making them visible to other packages. .library( diff --git a/Sources/Punchnet/SDLContext.swift b/Sources/Punchnet/SDLContext.swift index f2b66bf..8b18c8f 100644 --- a/Sources/Punchnet/SDLContext.swift +++ b/Sources/Punchnet/SDLContext.swift @@ -15,6 +15,7 @@ import Combine 1. 处理rsa的加解密逻辑 */ +@available(macOS 14, *) public class SDLContext: @unchecked Sendable { // 路由信息 @@ -583,12 +584,6 @@ public class SDLContext: @unchecked Sendable { self.superClient = nil } -} - -//--MARK: 获取设备的UUID - -extension SDLContext { - public static func getUUID() -> String { let userDefaults = UserDefaults.standard if let uuid = userDefaults.value(forKey: "gClientId") as? String { diff --git a/Sources/Punchnet/SDLNatProber.swift b/Sources/Punchnet/SDLNatProber.swift index 8ea3417..b61fe93 100644 --- a/Sources/Punchnet/SDLNatProber.swift +++ b/Sources/Punchnet/SDLNatProber.swift @@ -9,6 +9,7 @@ import Foundation import NIOCore // 网络类型探测器 +@available(macOS 14, *) struct SDLNatProber { // 定义nat类型 diff --git a/Sources/Punchnet/SDLNoticeClient.swift b/Sources/Punchnet/SDLNoticeClient.swift index 87f0831..578abff 100644 --- a/Sources/Punchnet/SDLNoticeClient.swift +++ b/Sources/Punchnet/SDLNoticeClient.swift @@ -19,6 +19,7 @@ import NIOCore import NIOPosix // 处理和sn-server服务器之间的通讯 +@available(macOS 14, *) actor SDLNoticeClient { private let group = MultiThreadedEventLoopGroup(numberOfThreads: 1) private let asyncChannel: NIOAsyncChannel, AddressedEnvelope> diff --git a/Sources/Punchnet/SDLSuperClient.swift b/Sources/Punchnet/SDLSuperClient.swift index 8accab8..fa48c27 100644 --- a/Sources/Punchnet/SDLSuperClient.swift +++ b/Sources/Punchnet/SDLSuperClient.swift @@ -10,6 +10,7 @@ import NIOCore import NIOPosix // --MARK: 和SuperNode的客户端 +@available(macOS 14, *) actor SDLSuperClient { private let group = MultiThreadedEventLoopGroup(numberOfThreads: 1) private let asyncChannel: NIOAsyncChannel diff --git a/Sources/Punchnet/SDLUDPHole.swift b/Sources/Punchnet/SDLUDPHole.swift index 61ebcca..10426fc 100644 --- a/Sources/Punchnet/SDLUDPHole.swift +++ b/Sources/Punchnet/SDLUDPHole.swift @@ -10,6 +10,7 @@ import NIOCore import NIOPosix // 处理和sn-server服务器之间的通讯 +@available(macOS 14, *) actor SDLUDPHole { private let group = MultiThreadedEventLoopGroup(numberOfThreads: 1) private let asyncChannel: NIOAsyncChannel, AddressedEnvelope>