Publish Zonghengjia Windows 0.3.13 client source

This commit is contained in:
2026-11-13 10:35:04 +08:00
parent 1590443809
commit 839434a313
55 changed files with 2324 additions and 963 deletions
+4 -12
View File
@@ -9,11 +9,6 @@ internal sealed record TransportDiagnostic(string Event, string Reason, string N
internal string SafeMessage => $"transport event={Identifier(Event)} reason={Identifier(Reason)} node={Identifier(Node)}";
}
internal sealed class TailnetUnavailableException(string reason) : IOException("当前授权节点的 Tailscale 入口未通过验证。")
{
internal string Reason { get; } = reason;
}
internal static class NodeTransportConnector
{
internal static async Task<string> RebindAsync(string current, string? original,
@@ -72,7 +67,7 @@ internal static class NodeTransportConnector
Action<string> requireRoute, Action<string> status, Func<long> ticks,
CancellationToken token, bool allowKnownEndpoints = false,
Func<string, int, CancellationToken, Task<bool>>? endpointProbe = null,
bool tailnetOnly = false, Action<TransportDiagnostic>? diagnostic = null)
Action<TransportDiagnostic>? diagnostic = null)
{
token.ThrowIfCancellationRequested();
var reason = "cooldown_active";
@@ -94,7 +89,7 @@ internal static class NodeTransportConnector
tailnet = null;
reason = "route_unavailable";
Report("tailnet_skipped", reason);
status(tailnetOnly ? "Tailscale 无独立内网路由,继续检测其他授权内网节点" : "Tailscale 无独立内网路由,使用同一节点公网入口");
status("Tailscale 无独立内网路由,使用同一节点公网入口");
}
}
if (tailnet is not null && endpointProbe is not null)
@@ -112,7 +107,7 @@ internal static class NodeTransportConnector
tailnet = null;
reason = "endpoint_unreachable";
Report("tailnet_skipped", reason);
status(tailnetOnly ? "内网 IP Ping 不通,继续其他授权内网节点" : "内网 IP Ping 不通,回退域名并保持");
status("内网 IP Ping 不通,使用同一节点公网入口");
}
}
if (tailnet is not null)
@@ -141,13 +136,10 @@ internal static class NodeTransportConnector
await stop();
reason = "proxy_health_or_start_failed";
Report("tailnet_failed", reason);
status(tailnetOnly ? "Tailscale 代理出口验证失败,继续检测其他授权内网节点" : "Tailscale 协议或代理出口验证失败,回退同一节点公网入口");
status("Tailscale 协议或代理出口验证失败,回退同一节点公网入口");
}
}
token.ThrowIfCancellationRequested();
// Automatic selection can test ALL authorized Tailnet nodes first. A
// failed alternate must not launch public ingress before that pass ends.
if (tailnetOnly) throw new TailnetUnavailableException(reason);
var commitDomain = response.ConnectionScope != PrivateAuxiliaryRouting.Scope && response.RouteMode is "smart" or "global";
try { await start(response.GetRuntimeConfigJson(), token); }
catch (ClientRuntimeException) { throw; }