using System.Text.Json; namespace UCVL.VPNPlus; // Opt-in CLI acceptance telemetry from the actual WinForms connection/timer // path. Contains only lifecycle, node, health and process ID, never account data. internal static class ConnectionAcceptanceTrace { internal static bool Enabled { get; set; } internal static void Record(string phase, string? node, bool connected, int? coreId, int failures = 0) { if (!Enabled) return; try { File.AppendAllText(Path.Combine(AppContext.BaseDirectory, "ui-connection-self-test.jsonl"), JsonSerializer.Serialize(new { time = DateTimeOffset.Now, phase, node, connected, coreId, failures }) + Environment.NewLine); } catch { /* Acceptance reporting cannot interrupt network recovery. */ } } }