diff --git a/Tun/Punchnet/NetworkStack/SDLAddressResolver.swift b/Tun/Punchnet/NetworkStack/SDLAddressResolver.swift deleted file mode 100644 index 92ed73d..0000000 --- a/Tun/Punchnet/NetworkStack/SDLAddressResolver.swift +++ /dev/null @@ -1,41 +0,0 @@ -// -// SDLAddressResolverPool.swift -// Tun -// -// Created by 安礼成 on 2026/2/3. -// - -import Foundation -import NIOCore -import NIOPosix - -actor SDLAddressResolver { - static let shared = SDLAddressResolver(threads: System.coreCount) - - private let pool: NIOThreadPool - private var cache: [String: SocketAddress] = [:] - - private init(threads: Int = 2) { - self.pool = NIOThreadPool(numberOfThreads: threads) - self.pool.start() - } - - func resolve(host: String, port: Int) async throws -> SocketAddress { - let key = "\(host):\(port)" - if let cached = cache[key] { - return cached - } - - let address = try await pool.runIfActive { - try SocketAddress.makeAddressResolvingHost(host, port: port) - } - cache[key] = address - - return address - } - - deinit { - pool.shutdownGracefully { _ in } - } - -}