Add custom on-demand rules support

This commit is contained in:
世界
2025-12-30 00:18:43 +08:00
parent 6de410c3f7
commit 58b5e9d732
13 changed files with 1310 additions and 59 deletions
+3 -2
View File
@@ -13,7 +13,7 @@ open class ExtensionProvider: NEPacketTunnelProvider {
private var commandServer: LibboxCommandServer!
private var platformInterface: ExtensionPlatformInterface!
override open func startTunnel(options _: [String: NSObject]?) async throws {
override open func startTunnel(options startOptions: [String: NSObject]?) async throws {
let options = LibboxSetupOptions()
options.basePath = FilePath.sharedDirectory.relativePath
options.workingPath = FilePath.workingDirectory.relativePath
@@ -68,9 +68,10 @@ open class ExtensionProvider: NEPacketTunnelProvider {
}
private func startService() async throws {
let profileID = await SharedPreferences.selectedProfileID.get()
let profile: Profile?
do {
profile = try await ProfileManager.get(Int64(SharedPreferences.selectedProfileID.get()))
profile = try await ProfileManager.get(profileID)
} catch {
throw ExtensionStartupError("(packet-tunnel) error: read selected profile: \(error.localizedDescription)")
}