Add SwiftUI + Network Extension (LibXray/hev), parse Clash Meta YAML from subscription URLs into vless/trojan/hy2 share links, keep the selected server on connect, and ship Navis-3.8.2.13.ipa with versioned changelog. Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.4 KiB
Swift
38 lines
1.4 KiB
Swift
import Foundation
|
|
|
|
/// Hysteria2 in-process runner.
|
|
/// Uses NavisCore when linked; otherwise returns a clear error (cannot mix a second Go runtime with LibXray).
|
|
enum Hy2CoreRunner {
|
|
private static var running = false
|
|
|
|
static func start(configPath: String, workDir: String) throws {
|
|
#if canImport(NavisCore)
|
|
NavisCoreSetWorkDir(workDir)
|
|
if let yaml = try? String(contentsOfFile: configPath, encoding: .utf8) {
|
|
var error: NSError?
|
|
// Generated gomobile name may vary; keep a stable Swift wrapper once NavisCore is produced.
|
|
_ = yaml
|
|
_ = error
|
|
}
|
|
throw TunnelError.message("Hysteria2: NavisCore.StartHy2YAML ещё не подключён в этой сборке")
|
|
#else
|
|
// LibXray already occupies the Go runtime in this appex.
|
|
// Unified NavisCore (Xray+Hy2) is the path forward; until then ask users for Xray links.
|
|
_ = configPath
|
|
_ = workDir
|
|
running = false
|
|
throw TunnelError.message(
|
|
"Hysteria2: в этой iOS-сборке активен LibXray (VLESS/VMess/Trojan). Hy2 требует единый NavisCore — пока используйте Xray-ссылку."
|
|
)
|
|
#endif
|
|
}
|
|
|
|
static func stop() {
|
|
#if canImport(NavisCore)
|
|
_ = NavisCoreStop()
|
|
#endif
|
|
running = false
|
|
LibXrayCore.stop() // no-op if not xray
|
|
}
|
|
}
|