Windows 0.3.1 clean monitor source delta; no private history or other platform changes

This commit is contained in:
2026-10-27 02:00:33 +00:00
parent 366b3c5c9a
commit 1cf54a46e4
40 changed files with 983 additions and 206 deletions
+7 -7
View File
@@ -77,7 +77,7 @@ internal static class PrivateAuxiliaryRoutingSelfTest
[slow, fast], empty, Tie, default)).SequenceEqual([slow, fast]);
var domain = new PrivateAuxiliaryNode { Slug = "same-site", Name = "济南(博翠明湖)", Status = "candidate",
Contract = 1, ExpiresAt = now.AddMinutes(3), TlsLeafSha256 = new string('a', 64),
ProbeIpv4 = "192.0.2.1", ConnectAddress = "vpn.toplc.cn", ProbePort = 11080 };
ProbeIpv4 = "192.0.2.1", ConnectAddress = "vpn.example.invalid", ProbePort = 11080 };
Task<long?> PublicFast(PrivateAuxiliaryNode n, CancellationToken t) => Task.FromResult<long?>(n == domain ? 1 : 90);
checks["internal_priority_even_when_domain_ping_is_faster"] = (await PrivateAuxiliaryRouting.RankByLatencyAsync(
[domain, slow], empty, PublicFast, default)).SequenceEqual([slow, domain]);
@@ -85,7 +85,7 @@ internal static class PrivateAuxiliaryRoutingSelfTest
Contract = 1, ExpiresAt = now.AddMinutes(3), TlsLeafSha256 = new string('a', 64),
ProbeIpv4 = "100.64.0.4", ConnectionEndpoints = [
new() { Address = "100.64.0.4", ProbeIpv4 = "100.64.0.4", Port = 18081 },
new() { Address = "vpn.toplc.cn", ProbeIpv4 = "192.0.2.1", Port = 11080 }] };
new() { Address = "vpn.example.invalid", ProbeIpv4 = "192.0.2.1", Port = 11080 }] };
Task<long?> Both(PrivateAuxiliaryNode n, CancellationToken t) => Task.FromResult<long?>(n.ProbePort == 11080 ? 1 : 90);
var fixedSite = ConnectionSelection.Create(true, "same-site", ["same-site"]);
var sameSiteRanking = await PrivateAuxiliaryRouting.RankForSelectionAsync(fixedSite, [oneSite], empty, false, Both, default);
@@ -94,16 +94,16 @@ internal static class PrivateAuxiliaryRoutingSelfTest
checks["manual_can_fallback_transport_not_node"] = ConnectionAttemptPlanner.CreateRanked(fixedSite, sameSiteRanking, 3)
.All(a => a.IsPrivate && a.Slug == "same-site");
var renewal = PrivateAuxiliaryRouting.ForRenewal(oneSite, domain);
checks["renewal_keeps_working_domain_not_preferred_tailnet"] = renewal.EndpointHost == "vpn.toplc.cn"
checks["renewal_keeps_working_domain_not_preferred_tailnet"] = renewal.EndpointHost == "vpn.example.invalid"
&& renewal.ProbePort == 11080 && renewal.ExpiresAt == oneSite.ExpiresAt;
checks["renewal_keeps_working_internal_endpoint"] = PrivateAuxiliaryRouting.ForRenewal(oneSite, sameSiteRanking[0]).ProbeIpv4 == "100.64.0.4";
checks["renewal_revoked_transport_rejected"] = Reject(() => PrivateAuxiliaryRouting.ForRenewal(oneSite, Node()));
checks["renewal_legacy_endpoint_preserved"] = PrivateAuxiliaryRouting.ForRenewal(grants[0], grants[0]) == grants[0];
Task<long?> OnlyDomain(PrivateAuxiliaryNode n, CancellationToken t) => Task.FromResult<long?>(n.ProbePort == 11080 ? 30 : null);
checks["failed_internal_selects_same_site_domain"] = (await PrivateAuxiliaryRouting.RankForSelectionAsync(
fixedSite, [oneSite], empty, false, OnlyDomain, default)).Single().EndpointHost == "vpn.toplc.cn";
fixedSite, [oneSite], empty, false, OnlyDomain, default)).Single().EndpointHost == "vpn.example.invalid";
var domainConfig = Config(mutate: r => {
r["outbounds"]![0]!["settings"]!["servers"]![0]!["address"] = "vpn.toplc.cn";
r["outbounds"]![0]!["settings"]!["servers"]![0]!["address"] = "vpn.example.invalid";
r["outbounds"]![0]!["settings"]!["servers"]![0]!["port"] = 11080;
});
// The fixture config helper is defined below; domain validation is checked there.
@@ -155,9 +155,9 @@ internal static class PrivateAuxiliaryRoutingSelfTest
checks["compatible_private_config_accepted"] = !Reject(() => PrivateAuxiliaryRouting.ValidateConfig(grants[0], Config(), "smart"));
var sameSlugDomain = new PrivateAuxiliaryNode { Slug = "jinan-private", Status = "candidate", Contract = 1,
ExpiresAt = now.AddMinutes(3), TlsLeafSha256 = new string('a', 64), ProbeIpv4 = "192.0.2.1",
ConnectAddress = "vpn.toplc.cn", ProbePort = 11080 };
ConnectAddress = "vpn.example.invalid", ProbePort = 11080 };
checks["authorized_domain_mapping_config_accepted"] = !Reject(() => PrivateAuxiliaryRouting.ValidateConfig(sameSlugDomain, domainConfig, "smart"));
checks["domain_runtime_keeps_real_hostname"] = PrivateAuxiliaryRuntime.Address(domainConfig.GetRuntimeConfigJson()) == "vpn.toplc.cn";
checks["domain_runtime_keeps_real_hostname"] = PrivateAuxiliaryRuntime.Address(domainConfig.GetRuntimeConfigJson()) == "vpn.example.invalid";
foreach (var address in new[] { "192.168.50.170", "100.64.0.4" }) {
var phoneGrant = Node(address: address);
var phoneConfig = Config(mutate: r => r["outbounds"]![0]!["settings"]!["servers"]![0]!["address"] = address);