using System.Text.Json.Serialization; namespace Monitor.Probe; /// /// probe.json:面板 POST /api/admin/probe/identity 生成的文件(只能下载一次)。 /// limits 是本地硬上限,面板无法修改;在路由器上建议调低,避免 Probe 自己的 CPU 成为瓶颈、反过来影响测量。 /// public sealed class ProbeFile { [JsonPropertyName("probe_id")] public string ProbeId { get; set; } = ""; /// PKCS#8,base64。 [JsonPropertyName("private_key")] public string PrivateKey { get; set; } = ""; /// 首次连接用的 Agent;连上之后以 agents.json(最新的列表)为准。 [JsonPropertyName("bootstrap")] public List Bootstrap { get; set; } = []; [JsonPropertyName("limits")] public ProbeLimits Limits { get; set; } = new(); } public sealed class BootstrapAgent { [JsonPropertyName("agent_id")] public string AgentId { get; set; } = ""; [JsonPropertyName("host")] public string Host { get; set; } = ""; [JsonPropertyName("tcp_port")] public int TcpPort { get; set; } /// Agent 的 TLS 证书指纹(SHA-256,base64)。 [JsonPropertyName("spki")] public string Spki { get; set; } = ""; } public sealed class ProbeLimits { /// 按需测试里单个阶段允许的最大码率(Mbit/s)。 [JsonPropertyName("max_test_mbps")] public double MaxTestMbps { get; set; } = 100; /// 按需测试里单个阶段允许的最大包速率。 [JsonPropertyName("max_total_pps")] public long MaxTotalPps { get; set; } = 20_000; } [JsonSerializable(typeof(ProbeFile))] [JsonSerializable(typeof(AgentsCache))] public sealed partial class ProbeConfigContext : JsonSerializerContext; /// agents.json:最近一次从 Agent 同步到的列表(配置,不是测量数据)。 public sealed class AgentsCache { [JsonPropertyName("version")] public long Version { get; set; } [JsonPropertyName("agents")] public List Agents { get; set; } = []; }