Fix libbox connection
This commit is contained in:
@@ -58,6 +58,11 @@ public enum SharedPreferences {
|
||||
|
||||
public static let systemProxyEnabled = Preference<Bool>("system_proxy_enabled", defaultValue: true)
|
||||
|
||||
#if os(tvOS)
|
||||
public static let commandServerPort = Preference<Int32>("tv_command_server_port", defaultValue: 0)
|
||||
public static let commandServerSecret = Preference<String>("tv_command_server_secret", defaultValue: "")
|
||||
#endif
|
||||
|
||||
// Profile Override
|
||||
|
||||
public static let excludeDefaultRoute = Preference<Bool>("exclude_default_route", defaultValue: false)
|
||||
|
||||
@@ -19,6 +19,12 @@ open class ExtensionProvider: NEPacketTunnelProvider {
|
||||
options.workingPath = FilePath.workingDirectory.relativePath
|
||||
options.tempPath = FilePath.cacheDirectory.relativePath
|
||||
options.logMaxLines = 3000
|
||||
|
||||
#if os(tvOS)
|
||||
options.commandServerListenPort = await SharedPreferences.commandServerPort.get()
|
||||
options.commandServerSecret = await SharedPreferences.commandServerSecret.get()
|
||||
#endif
|
||||
|
||||
var setupError: NSError?
|
||||
LibboxSetup(options, &setupError)
|
||||
if let setupError {
|
||||
@@ -61,16 +67,6 @@ open class ExtensionProvider: NEPacketTunnelProvider {
|
||||
}
|
||||
}
|
||||
|
||||
public func writeFatalError(_ message: String) {
|
||||
#if DEBUG
|
||||
NSLog(message)
|
||||
#endif
|
||||
if let commandServer {
|
||||
commandServer.setError(message)
|
||||
}
|
||||
cancelTunnelWithError(nil)
|
||||
}
|
||||
|
||||
private func startService() async throws {
|
||||
let profile: Profile?
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user