fix open method

This commit is contained in:
anlicheng 2025-07-16 17:47:54 +08:00
parent 5c10c7a33b
commit 035ec9343d

View File

@ -79,7 +79,7 @@ public class SDLContext: @unchecked Sendable {
private var flowTracer = SDLFlowTracerActor() private var flowTracer = SDLFlowTracerActor()
private var flowTracerCancel: AnyCancellable? private var flowTracerCancel: AnyCancellable?
init(provider: NEPacketTunnelProvider, config: SDLConfiguration, rsaCipher: RSACipher, aesCipher: AESCipher) throws { public init(provider: NEPacketTunnelProvider, config: SDLConfiguration, rsaCipher: RSACipher, aesCipher: AESCipher) throws {
self.config = config self.config = config
self.rsaCipher = rsaCipher self.rsaCipher = rsaCipher
self.aesCipher = aesCipher self.aesCipher = aesCipher
@ -96,7 +96,7 @@ public class SDLContext: @unchecked Sendable {
self.noticeClient = SDLNoticeClient() self.noticeClient = SDLNoticeClient()
} }
func start() async throws { public func start() async throws {
try await self.startSuperClient() try await self.startSuperClient()
try await self.startUDPHole() try await self.startUDPHole()
self.noticeClient.start() self.noticeClient.start()
@ -350,7 +350,7 @@ public class SDLContext: @unchecked Sendable {
} }
// //
func flowReportTask() { public func flowReportTask() {
Task { Task {
// //
self.flowTracerCancel = Timer.publish(every: 60.0, on: .main, in: .common).autoconnect() self.flowTracerCancel = Timer.publish(every: 60.0, on: .main, in: .common).autoconnect()
@ -506,7 +506,7 @@ public class SDLContext: @unchecked Sendable {
extension SDLContext { extension SDLContext {
static func getUUID() -> String { public static func getUUID() -> String {
let userDefaults = UserDefaults.standard let userDefaults = UserDefaults.standard
if let uuid = userDefaults.value(forKey: "gClientId") as? String { if let uuid = userDefaults.value(forKey: "gClientId") as? String {
return uuid return uuid
@ -519,7 +519,7 @@ extension SDLContext {
} }
// mac // mac
static func getMacAddress() -> Data { public static func getMacAddress() -> Data {
let key = "gMacAddress2" let key = "gMacAddress2"
let userDefaults = UserDefaults.standard let userDefaults = UserDefaults.standard