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>
33 lines
896 B
Swift
33 lines
896 B
Swift
import Foundation
|
|
import HevSocks5Tunnel
|
|
|
|
/// Bridges NE utun fd ↔ local SOCKS (macOS sysproxy replacement).
|
|
enum HevBridge {
|
|
static func writeConfig(socksHost: String = "127.0.0.1", socksPort: Int = 1080, to url: URL) throws {
|
|
let yaml = """
|
|
tunnel:
|
|
mtu: 1400
|
|
socks5:
|
|
address: \(socksHost)
|
|
port: \(socksPort)
|
|
udp: 'udp'
|
|
misc:
|
|
task-stack-size: 24576
|
|
connect-timeout: 5000
|
|
read-write-timeout: 60000
|
|
log-level: warn
|
|
"""
|
|
try yaml.write(to: url, atomically: true, encoding: .utf8)
|
|
}
|
|
|
|
/// Blocks until quit — call on a background thread.
|
|
@discardableResult
|
|
static func runBlocking(configPath: String, tunFd: Int32) -> Int32 {
|
|
hev_socks5_tunnel_main(configPath, tunFd)
|
|
}
|
|
|
|
static func quit() {
|
|
hev_socks5_tunnel_quit()
|
|
}
|
|
}
|