feat: detect an agent's public IPv4 and IPv6 addresses automatically, manual values still win [CI]
ci/woodpecker/push/main-amd64-build Pipeline was successful

This commit is contained in:
justme committed 2026-10-07 18:12:17 +08:00
1 parent 9966ea5d63
commit f03988d68b
26 files changed
+517 -33

No files matched your search

@@ -25,7 +25,10 @@ public sealed record AgentRecord(
long RowVersion,
string Ipv6Host = "",
bool Ipv6Supported = false,
string? Ipv6DiagnosticsJson = null);
string? Ipv6DiagnosticsJson = null,
bool PublicHostManual = false,
bool Ipv6HostManual = false,
IReadOnlyList<string>? ReportedAddresses = null);
/// <summary>管理员可以修改的字段(merge-patch 语义:为 null 的字段不改)。</summary>
public sealed class AgentPatch
@@ -38,6 +41,11 @@ public sealed class AgentPatch
public string? Ipv6Host { get; init; }
/// <summary>为 true:撤销手填,回到自动识别(<see cref="PublicHost"/> 同时给出则忽略)。</summary>
public bool? PublicHostAuto { get; init; }
public bool? Ipv6HostAuto { get; init; }
public bool? PublicVisible { get; init; }
}
@@ -50,7 +58,8 @@ public sealed record AgentHello(
int? ProbeTcpPort,
IReadOnlyList<int>? ProbeUdpPorts,
bool Ipv6Supported = false,
string? Ipv6DiagnosticsJson = null);
string? Ipv6DiagnosticsJson = null,
IReadOnlyList<string>? Addresses = null);
/// <summary>注册之后 MoShiro 的补充:公开地址和端口。</summary>
public sealed record AgentEnrollment(string PublicHost, int ProbeTcpPort, IReadOnlyList<int> ProbeUdpPorts, IReadOnlyList<string> Kinds);