Publish reviewed history-free open-source snapshot (2026-10-12)
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace UCVL.VPNPlus;
|
||||
|
||||
// Non-interactive recovery for a verified, separate test watchdog. No login,
|
||||
// connection, install, token export, or forced takeover of another owner's lease.
|
||||
internal static class NetworkRecoveryTool
|
||||
{
|
||||
internal static async Task<int> RunAsync()
|
||||
{
|
||||
var report = new Dictionary<string, object> {
|
||||
["time"] = DateTimeOffset.Now, ["kind"] = "recover_owned_network_only", ["passed"] = false,
|
||||
};
|
||||
try
|
||||
{
|
||||
using var deadline = new CancellationTokenSource(TimeSpan.FromSeconds(45));
|
||||
await using (var manager = new XrayManager())
|
||||
await manager.InitializeAsync(deadline.Token).ConfigureAwait(false);
|
||||
if (new[] { AppPaths.TunStateFile, AppPaths.ProxyStateFile, AppPaths.PidFile,
|
||||
Path.Combine(AppPaths.DataDirectory, "proxy-dns-owned.json") }.Any(File.Exists))
|
||||
throw new IOException("Network recovery journal remains; recovery has not been confirmed.");
|
||||
report["passed"] = true;
|
||||
return 0;
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
report["error"] = error.GetBaseException().Message;
|
||||
return 51;
|
||||
}
|
||||
finally
|
||||
{
|
||||
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "network-recovery-result.json"),
|
||||
JsonSerializer.Serialize(report, new JsonSerializerOptions { WriteIndented = true }));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user