Windows 0.3.1 clean monitor source delta; no private history or other platform changes
This commit is contained in:
@@ -29,41 +29,25 @@ internal static class NodeTransportConnector
|
||||
throw new InvalidOperationException("缺少可验证的同节点原入口,未尝试切换。");
|
||||
var selected = current;
|
||||
var fallback = original;
|
||||
if (!tailnet && preferredTailnetConfig is not null)
|
||||
{
|
||||
// Only a confirmed physical-network recovery calls this method.
|
||||
// Re-check the cached alternate of this SAME authorized config; a
|
||||
// previous-network cooldown must not make public ingress sticky.
|
||||
if (!TailnetTransport.SameAuthorizedFallback(preferredTailnetConfig, current))
|
||||
throw new InvalidOperationException("Tailscale 恢复入口与当前授权线路不匹配。");
|
||||
if (requireRoute is null || endpointProbe is null)
|
||||
throw new InvalidOperationException("Tailscale 恢复入口缺少独立路由或端口验证。");
|
||||
var recheckReason = "route_unavailable";
|
||||
try
|
||||
{
|
||||
var address = TailnetTransport.Address(preferredTailnetConfig)!;
|
||||
requireRoute(address);
|
||||
token.ThrowIfCancellationRequested();
|
||||
recheckReason = "endpoint_unreachable";
|
||||
if (!await endpointProbe(address, TailnetTransport.Port(preferredTailnetConfig), token))
|
||||
diagnostic?.Invoke(new("rebind_skipped", "endpoint_unreachable", ""));
|
||||
else
|
||||
{
|
||||
token.ThrowIfCancellationRequested();
|
||||
selected = preferredTailnetConfig;
|
||||
fallback = current;
|
||||
tailnet = true;
|
||||
diagnostic?.Invoke(new("rebind_attempt", "tailnet_recovered", ""));
|
||||
}
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException && e is not LocalNetworkException)
|
||||
{ diagnostic?.Invoke(new("rebind_skipped", recheckReason, "")); }
|
||||
}
|
||||
// Once domain fallback has been selected, physical-network recovery
|
||||
// retains it. Do not probe/promote a cached internal alternative.
|
||||
// Only an explicit new user connection may select the internal IP again.
|
||||
token.ThrowIfCancellationRequested();
|
||||
using var deadline = CancellationTokenSource.CreateLinkedTokenSource(token);
|
||||
if (tailnet) deadline.CancelAfter(TimeSpan.FromSeconds(45));
|
||||
try
|
||||
{
|
||||
if (tailnet && endpointProbe is not null)
|
||||
{
|
||||
var available = await endpointProbe(TailnetTransport.Address(selected)!, TailnetTransport.Port(selected), deadline.Token);
|
||||
token.ThrowIfCancellationRequested();
|
||||
if (!available)
|
||||
{
|
||||
selected = fallback!;
|
||||
tailnet = false;
|
||||
diagnostic?.Invoke(new("rebind_fallback", "ping_unreachable", ""));
|
||||
}
|
||||
}
|
||||
await start(selected, deadline.Token);
|
||||
if (tailnet && !await proxyHealth(deadline.Token)) throw new IOException("Tailscale 切网后出口未通过。");
|
||||
deadline.Token.ThrowIfCancellationRequested();
|
||||
@@ -117,9 +101,9 @@ internal static class NodeTransportConnector
|
||||
{
|
||||
try
|
||||
{
|
||||
status("正在检测 Tailscale 入口(最多 3 秒)");
|
||||
status("正在 Ping 代理内网 IP(最多 1 秒)");
|
||||
if (!await endpointProbe(TailnetTransport.Address(tailnet)!, TailnetTransport.Port(tailnet), token))
|
||||
throw new IOException("Tailscale 端口不可达。");
|
||||
throw new IOException("代理内网 IP Ping 不通。");
|
||||
token.ThrowIfCancellationRequested();
|
||||
}
|
||||
catch (Exception e) when (e is not OperationCanceledException)
|
||||
@@ -128,7 +112,7 @@ internal static class NodeTransportConnector
|
||||
tailnet = null;
|
||||
reason = "endpoint_unreachable";
|
||||
Report("tailnet_skipped", reason);
|
||||
status(tailnetOnly ? "Tailscale 端口不可达,继续检测其他授权内网节点" : "Tailscale 端口不可达,使用同一节点公网入口");
|
||||
status(tailnetOnly ? "内网 IP Ping 不通,继续其他授权内网节点" : "内网 IP Ping 不通,回退域名并保持");
|
||||
}
|
||||
}
|
||||
if (tailnet is not null)
|
||||
@@ -163,6 +147,8 @@ internal static class NodeTransportConnector
|
||||
// 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);
|
||||
if (response.ConnectionScope != PrivateAuxiliaryRouting.Scope && response.RouteMode is "smart" or "global")
|
||||
preference.CommitDomainFallback();
|
||||
Report("selected", "public_ingress");
|
||||
await start(response.GetRuntimeConfigJson(), token);
|
||||
token.ThrowIfCancellationRequested();
|
||||
|
||||
Reference in New Issue
Block a user