Compare commits

..

1 Commits

13 changed files with 326 additions and 35 deletions
+24
View File
@@ -106,5 +106,29 @@
"OtherComponentsModified": false, "OtherComponentsModified": false,
"ProductionAccepted": false, "ProductionAccepted": false,
"SourceOnly": true "SourceOnly": true
},
"Windows023TailnetDisplayDelta": {
"ChangedWindowsFiles": [
"windows/DashboardInteractionSelfTest.cs",
"windows/DashboardLayout.cs",
"windows/DashboardTailnetLayoutSelfTest.cs",
"windows/MainForm.Dashboard.cs",
"windows/MainForm.Selection.cs",
"windows/MainForm.TailnetTraffic.cs",
"windows/MainForm.cs",
"windows/VPNPlus.csproj",
"windows/release/RELEASE-NOTES-0.2.23.md"
],
"ExampleEndpointChanges": [],
"OptionalUnlicensedSceneRemainsOmitted": true,
"OriginalAcceptanceTransferred": false,
"OriginalSourceManifestSha256": "b77d3912a8f910f84be94a7adc81d0bd1926310db8c57b83d61a4d72763da2ad",
"OtherComponentsModified": false,
"PrivateHistoryIncluded": false,
"PrivateSourceCommit": "e28648198536bdc560a06f05a4e821231e2ea644",
"ProductionAccepted": false,
"PublicBaseCommit": "3ccaea3d52f6b45eed33b7d2170d767aa73bff3d",
"SourceOnly": true,
"Version": "0.2.23"
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
# 纵横家开源源码 # 纵横家开源源码
此仓库是无私有 Git 历史的清洁源码快照:Windows 0.2.22、Django 后台及 iPhone/iPad 1.0.2。公司自有代码按 MIT 开源;第三方组件遵守原许可,公司商标及 Logo 不在 MIT 授权范围。Android 保留原 GPL-3.0 公开仓库,不重复拷贝或改换许可。 此仓库是无私有 Git 历史的清洁源码快照:Windows 0.2.23、Django 后台及 iPhone/iPad 1.0.2。公司自有代码按 MIT 开源;第三方组件遵守原许可,公司商标及 Logo 不在 MIT 授权范围。Android 保留原 GPL-3.0 公开仓库,不重复拷贝或改换许可。
| 目录 | 内容与状态 | | 目录 | 内容与状态 |
| --- | --- | | --- | --- |
+35 -9
View File
@@ -4,7 +4,7 @@
"ExportDiffersFromOriginalCandidates": true, "ExportDiffersFromOriginalCandidates": true,
"FilesBeforeProvenanceAndAudit": { "FilesBeforeProvenanceAndAudit": {
"LICENSE": "b7e94910b8dc377b0a05ccde3c6e5941838dfc15c9dd790078d11728205b524e", "LICENSE": "b7e94910b8dc377b0a05ccde3c6e5941838dfc15c9dd790078d11728205b524e",
"README.md": "607d74c04a6642f9cb596000f9b7f2b790610aa89dd32aeef007f254a406e89d", "README.md": "3c1651ca130628096d7a19f063742648eaa791fcf6574b721dc69b3a02016a6f",
"SECURITY.md": "34e56cd9b8f6aa5fee45921c6eb831a542e05e76e41850fc31c44e09de088b3c", "SECURITY.md": "34e56cd9b8f6aa5fee45921c6eb831a542e05e76e41850fc31c44e09de088b3c",
"THIRD_PARTY_NOTICES.md": "8c862f2f6b71440616a887e6deb7444a1262cf7d9f144208cc04041c3f9a3371", "THIRD_PARTY_NOTICES.md": "8c862f2f6b71440616a887e6deb7444a1262cf7d9f144208cc04041c3f9a3371",
"android/README.md": "bb4387da9a055e97f33bb29a883c543e0938fa858df3fd744abc80553a5ec65c", "android/README.md": "bb4387da9a055e97f33bb29a883c543e0938fa858df3fd744abc80553a5ec65c",
@@ -193,8 +193,9 @@
"windows/ConnectionSelfTest.cs": "6511feda4c81da766e745a499c682d2d0b3be0386c4ba424e7ddc04029ebca12", "windows/ConnectionSelfTest.cs": "6511feda4c81da766e745a499c682d2d0b3be0386c4ba424e7ddc04029ebca12",
"windows/DailyTrafficChart.cs": "4af8d8a91559e6a3fc1dd56db11f3534606aeb486ff918b2b301db0b82e4c716", "windows/DailyTrafficChart.cs": "4af8d8a91559e6a3fc1dd56db11f3534606aeb486ff918b2b301db0b82e4c716",
"windows/DashboardControls.cs": "b7b1ec34e78d96d23861b0236b945239f4e389d6b8494f53e95e5efe3f4c2182", "windows/DashboardControls.cs": "b7b1ec34e78d96d23861b0236b945239f4e389d6b8494f53e95e5efe3f4c2182",
"windows/DashboardInteractionSelfTest.cs": "0c91f8ccb702891395d85e4901220381468f576f3ed5b88972a7d7bd12f215e7", "windows/DashboardInteractionSelfTest.cs": "913357068c2962e2431da1917861d442567fa71fb0e7ddaea176f079d3b97251",
"windows/DashboardLayout.cs": "a761de5842c1aa03e68089dc90f73e0a2372532e5367b8e64198ba7b5bd6f8a8", "windows/DashboardLayout.cs": "233ca0dee2ae27bc81d520b60d9a20b004cf70bf334de2ba33e5956777154edd",
"windows/DashboardTailnetLayoutSelfTest.cs": "7bd2cba07f56c0c55da912e47efbec856c58e798b7c7218093adfbb2bfd69f29",
"windows/DashboardWheelRouter.cs": "d903097a5febbff296febb65855dc10b4e056ea5bb54d2df71b5d1f0297dcc1f", "windows/DashboardWheelRouter.cs": "d903097a5febbff296febb65855dc10b4e056ea5bb54d2df71b5d1f0297dcc1f",
"windows/GitReleasePolicySelfTest.cs": "c43d0e63e9c00a7c6b376ed204bc6c400572085075397685c92862e8318fe369", "windows/GitReleasePolicySelfTest.cs": "c43d0e63e9c00a7c6b376ed204bc6c400572085075397685c92862e8318fe369",
"windows/GitReleaseUpdater.cs": "dcd00a0feca6801aad4e346c7565d8bcd80b3fd24a4accbe5cd4643d04264b9b", "windows/GitReleaseUpdater.cs": "dcd00a0feca6801aad4e346c7565d8bcd80b3fd24a4accbe5cd4643d04264b9b",
@@ -216,10 +217,11 @@
"windows/LearningStore.cs": "cc1c6cf1b0c5b948e16be24a46dc2429a020cafa176a36ad9c450d887410169e", "windows/LearningStore.cs": "cc1c6cf1b0c5b948e16be24a46dc2429a020cafa176a36ad9c450d887410169e",
"windows/LearningTransportSelfTest.cs": "05dcfd3fcfc6f25e20612c020583eb6c36934c1b251e50e70fcd29501ad0efe7", "windows/LearningTransportSelfTest.cs": "05dcfd3fcfc6f25e20612c020583eb6c36934c1b251e50e70fcd29501ad0efe7",
"windows/MainForm.Chrome.cs": "30dc6520a44a5120c78c472c9fb053e2e4dea8e254b5531d04a5342964969c7a", "windows/MainForm.Chrome.cs": "30dc6520a44a5120c78c472c9fb053e2e4dea8e254b5531d04a5342964969c7a",
"windows/MainForm.Dashboard.cs": "f11943211bd43259e90ae357512870132fc4e6bdb6cf1b2cdca40382b47170d6", "windows/MainForm.Dashboard.cs": "584d888bf9d2f9c90ab481fa2716d69b15a037b2c51440a71865c2b69f548f3d",
"windows/MainForm.Handover.cs": "a7c6e81186be1d7a154c6997b7d44621543c163ba703901d7974632dd462d25f", "windows/MainForm.Handover.cs": "a7c6e81186be1d7a154c6997b7d44621543c163ba703901d7974632dd462d25f",
"windows/MainForm.Selection.cs": "297186f274b45cd9bf14fbc15492cbe026aea8902ffda386029cbcb75901e469", "windows/MainForm.Selection.cs": "d872004a98fc634e40c5edebf85eac7f3dfbb62fad8cafaae66a5c8470cfdaf3",
"windows/MainForm.cs": "729a5364fcb7d20b53198ba9619a28971029ab4162cced1b2fd4ba49812beccc", "windows/MainForm.TailnetTraffic.cs": "72b4dbad6595b866f103a10add769b815964d5100579518035385bc19a94f108",
"windows/MainForm.cs": "fdc0b3bb7b49f5bbf29140c631c54c60990757d06c9ca075c95e6b3d18261fec",
"windows/NOTICE.md": "8c862f2f6b71440616a887e6deb7444a1262cf7d9f144208cc04041c3f9a3371", "windows/NOTICE.md": "8c862f2f6b71440616a887e6deb7444a1262cf7d9f144208cc04041c3f9a3371",
"windows/NetworkHandover.cs": "b43548be0051cf92dfd332e537951e4b5083f2a123be8021994513bbc3748d46", "windows/NetworkHandover.cs": "b43548be0051cf92dfd332e537951e4b5083f2a123be8021994513bbc3748d46",
"windows/NetworkHandoverSelfTest.cs": "681d0154dc0aa5f49d7ce1f3088b465eea3ed82571b464951df8d4c89cecdf73", "windows/NetworkHandoverSelfTest.cs": "681d0154dc0aa5f49d7ce1f3088b465eea3ed82571b464951df8d4c89cecdf73",
@@ -243,7 +245,7 @@
"windows/Program.cs": "3545afc128a41b77d8c7365e36075bf01ebe379d8119e40343466968e7c25dea", "windows/Program.cs": "3545afc128a41b77d8c7365e36075bf01ebe379d8119e40343466968e7c25dea",
"windows/ProxyDnsPolicy.cs": "997e2e922ad43956932c1bd0a6da3457bc308ee723f4f77ff8e52aa23fa954c0", "windows/ProxyDnsPolicy.cs": "997e2e922ad43956932c1bd0a6da3457bc308ee723f4f77ff8e52aa23fa954c0",
"windows/ProxyProbe.cs": "5d27b5a6c6b192a0c0f3ec4637c5a876a71130497af57f7cb4a04ab4735ca1ec", "windows/ProxyProbe.cs": "5d27b5a6c6b192a0c0f3ec4637c5a876a71130497af57f7cb4a04ab4735ca1ec",
"windows/README.md": "e57715545f39c8e4ad0cbd0198ecfcb82be1601b5d1d8bad89abed6eb6ad1513", "windows/README.md": "5ec353b23490df795d096cd1a7d7f87be05b83aa2ae8bbdeaa4a4b7e93e45b76",
"windows/ReplacementContinuitySelfTest.cs": "107878ab2b367f1812377c0b209f6d620da390091c3882e4be53a48e517d86a1", "windows/ReplacementContinuitySelfTest.cs": "107878ab2b367f1812377c0b209f6d620da390091c3882e4be53a48e517d86a1",
"windows/RouteLeaseSelfTest.cs": "6189c66b9f66c58bed26de4441c58a9ec02b67257bfa04ed66d702acfcd054d9", "windows/RouteLeaseSelfTest.cs": "6189c66b9f66c58bed26de4441c58a9ec02b67257bfa04ed66d702acfcd054d9",
"windows/RoutingRuleBatches.cs": "9997bfa766fffe7bed7352f307c1f6f118a9be9aa86653eaefae3b2bdaa26c1e", "windows/RoutingRuleBatches.cs": "9997bfa766fffe7bed7352f307c1f6f118a9be9aa86653eaefae3b2bdaa26c1e",
@@ -265,7 +267,7 @@
"windows/UpdateSelfTest.cs": "453165bb611efb8db0d8a8c9ea13f3553e0047aa22b838c43096e3d83fe18771", "windows/UpdateSelfTest.cs": "453165bb611efb8db0d8a8c9ea13f3553e0047aa22b838c43096e3d83fe18771",
"windows/UpdateStreamSelfTest.cs": "ad059016c0197f33582b1969ab3280c5b9589a28d659613b3e97ce4a357d38c1", "windows/UpdateStreamSelfTest.cs": "ad059016c0197f33582b1969ab3280c5b9589a28d659613b3e97ce4a357d38c1",
"windows/UsageHistorySeries.cs": "9e7515ceede1899e06116352de79edd6252c921048bcae9958bf9358d93b3069", "windows/UsageHistorySeries.cs": "9e7515ceede1899e06116352de79edd6252c921048bcae9958bf9358d93b3069",
"windows/VPNPlus.csproj": "8623063d4b69ff256adb3f5565193a758318fd0173152543745cda9b9fb275d2", "windows/VPNPlus.csproj": "0669e7192f096654a766390564bf23caaa2abf93b0dc8b2f589b8f5679ad4334",
"windows/VpnApiClient.cs": "6e227467981bbc68aac7fb93fe32cfb96f06b0d06f04405209512f1a11c971af", "windows/VpnApiClient.cs": "6e227467981bbc68aac7fb93fe32cfb96f06b0d06f04405209512f1a11c971af",
"windows/WindowChrome.cs": "0eceea0879e792b8ae83a74eaf5658d4a7be6a798fbdb026ff8d19fa9aa6af2c", "windows/WindowChrome.cs": "0eceea0879e792b8ae83a74eaf5658d4a7be6a798fbdb026ff8d19fa9aa6af2c",
"windows/WindowChromeSelfTest.cs": "4bc45ed8c7357f360e1d17fe189698102b249cf6d7226c887faf5be4104f55af", "windows/WindowChromeSelfTest.cs": "4bc45ed8c7357f360e1d17fe189698102b249cf6d7226c887faf5be4104f55af",
@@ -304,7 +306,8 @@
"windows/licenses/Wintun-License.txt": "183adac21e7d96c508c8fd34d394b7b6708bc81564ad1bad61ab66143a008cd2", "windows/licenses/Wintun-License.txt": "183adac21e7d96c508c8fd34d394b7b6708bc81564ad1bad61ab66143a008cd2",
"windows/licenses/Xray-MPL-2.0.txt": "1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5", "windows/licenses/Xray-MPL-2.0.txt": "1f256ecad192880510e84ad60474eab7589218784b9a50bc7ceee34c2b91f1d5",
"windows/release/RELEASE-NOTES-0.2.21.md": "839f36685e39c04bf692ffd2896bab4538577c0b3bbddd0a3cc335fe13b65d4c", "windows/release/RELEASE-NOTES-0.2.21.md": "839f36685e39c04bf692ffd2896bab4538577c0b3bbddd0a3cc335fe13b65d4c",
"windows/release/RELEASE-NOTES-0.2.22.md": "bf6c8b448481f59a05e8653fbaa1356d986d2d481c3cbaf02fe6402dcf55d499" "windows/release/RELEASE-NOTES-0.2.22.md": "bf6c8b448481f59a05e8653fbaa1356d986d2d481c3cbaf02fe6402dcf55d499",
"windows/release/RELEASE-NOTES-0.2.23.md": "2f8aea1ec4d4f1bcc9860d8945dc6266be6ea924ff9958c589a6e4eb0550dc76"
}, },
"IosSourceCommit": "b07d085413b1b6370245866fd82271b76590b6d6", "IosSourceCommit": "b07d085413b1b6370245866fd82271b76590b6d6",
"Kind": "clean-history-free-open-source-export", "Kind": "clean-history-free-open-source-export",
@@ -357,5 +360,28 @@
"UnlicensedLoginSceneOmitted": true, "UnlicensedLoginSceneOmitted": true,
"Version": "0.2.22" "Version": "0.2.22"
}, },
"Windows023TailnetDisplayDelta": {
"ChangedWindowsFiles": [
"windows/DashboardInteractionSelfTest.cs",
"windows/DashboardLayout.cs",
"windows/DashboardTailnetLayoutSelfTest.cs",
"windows/MainForm.Dashboard.cs",
"windows/MainForm.Selection.cs",
"windows/MainForm.TailnetTraffic.cs",
"windows/MainForm.cs",
"windows/VPNPlus.csproj",
"windows/release/RELEASE-NOTES-0.2.23.md"
],
"OptionalUnlicensedSceneRemainsOmitted": true,
"OriginalAcceptanceTransferred": false,
"OriginalSourceManifestSha256": "b77d3912a8f910f84be94a7adc81d0bd1926310db8c57b83d61a4d72763da2ad",
"OtherComponentsModified": false,
"PrivateHistoryIncluded": false,
"PrivateSourceCommit": "e28648198536bdc560a06f05a4e821231e2ea644",
"ProductionAccepted": false,
"PublicBaseCommit": "3ccaea3d52f6b45eed33b7d2170d767aa73bff3d",
"SourceOnly": true,
"Version": "0.2.23"
},
"WindowsSourceCommit": "0d463e6af91a3802c564b06dabb6bf86ebff5a38" "WindowsSourceCommit": "0d463e6af91a3802c564b06dabb6bf86ebff5a38"
} }
+2 -1
View File
@@ -14,7 +14,7 @@ internal static class DashboardInteractionSelfTest
foreach (var check in form.CheckDashboardInteraction()) checks.Add(check.Key, check.Value); foreach (var check in form.CheckDashboardInteraction()) checks.Add(check.Key, check.Value);
} }
catch (Exception exception) { error = exception.ToString(); } catch (Exception exception) { error = exception.ToString(); }
var passed = error is null && checks.Count >= 15 && checks.Values.All(value => value); var passed = error is null && checks.Count >= 43 && checks.Values.All(value => value);
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "dashboard-interaction-self-test.json"), File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "dashboard-interaction-self-test.json"),
JsonSerializer.Serialize(new { passed, checks, error, scope = "owned synthetic WinForms fixture; no physical user-input or production acceptance claim", JsonSerializer.Serialize(new { passed, checks, error, scope = "owned synthetic WinForms fixture; no physical user-input or production acceptance claim",
network_modified = false, installed_client_modified = false, credentials_loaded = false }, new JsonSerializerOptions { WriteIndented = true })); network_modified = false, installed_client_modified = false, credentials_loaded = false }, new JsonSerializerOptions { WriteIndented = true }));
@@ -96,6 +96,7 @@ internal sealed partial class MainForm
checks["card_surface_is_half_transparent"] = CardPanel.SurfaceAlpha == 128; checks["card_surface_is_half_transparent"] = CardPanel.SurfaceAlpha == 128;
checks["whole_content_composition_disabled"] = !_content.ComposeChildren; checks["whole_content_composition_disabled"] = !_content.ComposeChildren;
checks["metric_dirty_refresh_clears_previous_digits"] = CheckMetricRefreshPaint(); checks["metric_dirty_refresh_clears_previous_digits"] = CheckMetricRefreshPaint();
foreach (var check in CheckTailnetTrafficUi()) checks.Add(check.Key, check.Value);
ShowLogin(); ShowLogin();
checks["hidden_dashboard_does_not_consume_login_wheel"] = !Wheel(_loginText, -120); checks["hidden_dashboard_does_not_consume_login_wheel"] = !Wheel(_loginText, -120);
RequestExit(); RequestExit();
+16 -7
View File
@@ -3,13 +3,13 @@ namespace UCVL.VPNPlus;
internal readonly record struct DashboardGeometry( internal readonly record struct DashboardGeometry(
Rectangle WelcomeLabel, Rectangle AccountLabel, Rectangle IdentityBadge, Rectangle WelcomeLabel, Rectangle AccountLabel, Rectangle IdentityBadge,
Rectangle LogoutButton, Rectangle StatusCard, Rectangle NodeCard, Rectangle ModeCard, Rectangle LogoutButton, Rectangle StatusCard, Rectangle NodeCard, Rectangle ModeCard,
Rectangle[] Metrics, Rectangle TrafficCard, Rectangle DailyCard, Rectangle Footer, Rectangle[] Metrics, Rectangle TrafficCard, Rectangle TailnetTrafficCard, Rectangle DailyCard, Rectangle Footer,
int ContentHeight, bool Compact); int ContentHeight, bool Compact);
// Logical pixels converted once, independent of WinForms autoscaling. // Logical pixels converted once, independent of WinForms autoscaling.
internal static class DashboardLayout internal static class DashboardLayout
{ {
internal static DashboardGeometry Calculate(Size viewport, int dpi) internal static DashboardGeometry Calculate(Size viewport, int dpi, bool showTailnet = false)
{ {
var scale = Math.Max(1f, dpi / 96f); var scale = Math.Max(1f, dpi / 96f);
int S(int n) => (int)Math.Round(n * scale); int S(int n) => (int)Math.Round(n * scale);
@@ -28,25 +28,30 @@ internal static class DashboardLayout
? new Rectangle(margin, node.Bottom + gap, width, node.Height) ? new Rectangle(margin, node.Bottom + gap, width, node.Height)
: new Rectangle(node.Right + gap, node.Top, width - half - gap, node.Height); : new Rectangle(node.Right + gap, node.Top, width - half - gap, node.Height);
var traffic = new Rectangle(margin, mode.Bottom + gap, compact ? width : half, S(276)); var traffic = new Rectangle(margin, mode.Bottom + gap, compact ? width : half, S(276));
var tailnet = showTailnet ? new Rectangle(traffic.Left, traffic.Bottom + gap, traffic.Width, traffic.Height) : Rectangle.Empty;
var daily = compact var daily = compact
? new Rectangle(margin, traffic.Bottom + gap, width, traffic.Height) ? new Rectangle(margin, (showTailnet ? tailnet.Bottom : traffic.Bottom) + gap, width, traffic.Height)
: new Rectangle(traffic.Right + gap, traffic.Top, width - half - gap, traffic.Height); : new Rectangle(traffic.Right + gap, traffic.Top, width - half - gap,
showTailnet ? tailnet.Bottom - traffic.Top : traffic.Height);
Rectangle Metric(Rectangle parent, int column) => new(S(14) + column * ((parent.Width - S(28)) / 2), S(43), (parent.Width - S(28)) / 2 - S(2), S(82)); Rectangle Metric(Rectangle parent, int column) => new(S(14) + column * ((parent.Width - S(28)) / 2), S(43), (parent.Width - S(28)) / 2 - S(2), S(82));
// Relative to their matching chart card: totals together; speeds together. // Relative to their matching chart card: totals together; speeds together.
Rectangle[] metrics = [Metric(daily, 0), Metric(traffic, 0), Metric(traffic, 1), Metric(daily, 1)]; Rectangle[] metrics = [Metric(daily, 0), Metric(traffic, 0), Metric(traffic, 1), Metric(daily, 1)];
var footer = new Rectangle(margin, daily.Bottom + gap, width, S(76)); var footer = new Rectangle(margin, daily.Bottom + gap, width, S(76));
return new(welcome, account, identity, logout, status, node, mode, metrics, traffic, return new(welcome, account, identity, logout, status, node, mode, metrics, traffic,
daily, footer, footer.Bottom + S(12), compact); tailnet, daily, footer, footer.Bottom + S(12), compact);
} }
internal static bool SelfTest() internal static bool SelfTest()
{ {
foreach (var dpi in new[] { 96, 120, 144, 168, 192, 240, 288 }) foreach (var dpi in new[] { 96, 120, 144, 168, 192, 240, 288 })
foreach (var width in new[] { 600, 620, 739, 760, 780, 900, 1100, 1600 }) foreach (var width in new[] { 600, 620, 739, 760, 780, 900, 1100, 1600 })
foreach (var showTailnet in new[] { false, true })
{ {
var viewport = new Size(width * dpi / 96, 560 * dpi / 96); var viewport = new Size(width * dpi / 96, 560 * dpi / 96);
var p = Calculate(viewport, dpi); var p = Calculate(viewport, dpi, showTailnet);
Rectangle[] cards = [p.StatusCard, p.NodeCard, p.ModeCard, p.TrafficCard, p.DailyCard, p.Footer]; Rectangle[] cards = showTailnet
? [p.StatusCard, p.NodeCard, p.ModeCard, p.TrafficCard, p.TailnetTrafficCard, p.DailyCard, p.Footer]
: [p.StatusCard, p.NodeCard, p.ModeCard, p.TrafficCard, p.DailyCard, p.Footer];
if (cards.Any(c => c.Left < 0 || c.Right > viewport.Width || c.Bottom > p.ContentHeight || c.Width <= 0)) return false; if (cards.Any(c => c.Left < 0 || c.Right > viewport.Width || c.Bottom > p.ContentHeight || c.Width <= 0)) return false;
for (var i = 0; i < cards.Length; i++) for (var i = 0; i < cards.Length; i++)
for (var j = i + 1; j < cards.Length; j++) for (var j = i + 1; j < cards.Length; j++)
@@ -55,6 +60,10 @@ internal static class DashboardLayout
if (p.Metrics[0].IntersectsWith(p.Metrics[3]) || p.Metrics[1].IntersectsWith(p.Metrics[2])) return false; if (p.Metrics[0].IntersectsWith(p.Metrics[3]) || p.Metrics[1].IntersectsWith(p.Metrics[2])) return false;
for (var i = 0; i < p.Metrics.Length; i++) for (var i = 0; i < p.Metrics.Length; i++)
if (p.Metrics[i].Right > (i == 0 || i == 3 ? p.DailyCard.Width : p.TrafficCard.Width)) return false; if (p.Metrics[i].Right > (i == 0 || i == 3 ? p.DailyCard.Width : p.TrafficCard.Width)) return false;
if (!showTailnet && p.TailnetTrafficCard != Rectangle.Empty) return false;
if (showTailnet && (p.TailnetTrafficCard.Top <= p.TrafficCard.Bottom
|| p.Compact && p.DailyCard.Top <= p.TailnetTrafficCard.Bottom
|| !p.Compact && (p.DailyCard.Top != p.TrafficCard.Top || p.DailyCard.Bottom != p.TailnetTrafficCard.Bottom))) return false;
} }
return true; return true;
} }
+88
View File
@@ -0,0 +1,88 @@
namespace UCVL.VPNPlus;
internal sealed partial class MainForm
{
// UI fixture only: independent supplied values, no adapter/core/route reads.
internal Dictionary<string, bool> CheckTailnetTrafficUi()
{
var checks = new Dictionary<string, bool>();
int TailnetPoints()
{
var queue = typeof(TrafficChart).GetField("_points", System.Reflection.BindingFlags.Instance
| System.Reflection.BindingFlags.NonPublic)!.GetValue(_tailnetTrafficChart)!;
return (int)queue.GetType().GetProperty("Count")!.GetValue(queue)!;
}
var originalSize = ClientSize;
SetTailnetTrafficVisibility(false);
ClientSize = new Size(ScaleLogical(960), ScaleLogical(720));
LayoutDashboard();
var baseTraffic = _trafficCard.Bounds;
var baseDaily = _dailyCard.Bounds;
var baseFooter = _footer.Bounds;
var baseHeight = _dashboardBody.Height;
checks["tailnet_absent_has_original_two_card_layout"] = !_tailnetTrafficCard.Visible
&& baseTraffic.Top == baseDaily.Top && baseTraffic.Bottom == baseDaily.Bottom;
_dashboardScrollBar.Value = Math.Min(35, Math.Max(0, _dashboardScrollBar.Maximum - _dashboardScrollBar.LargeChange + 1));
var previous = _dashboardScrollBar.Value;
SetTailnetTrafficVisibility(true);
checks["tailnet_wide_left_cards_stack"] = _tailnetTrafficCard.Left == _trafficCard.Left
&& _tailnetTrafficCard.Width == _trafficCard.Width && _tailnetTrafficCard.Top > _trafficCard.Bottom;
checks["tailnet_wide_right_history_spans_two_rows"] = _dailyCard.Top == _trafficCard.Top
&& _dailyCard.Bottom == _tailnetTrafficCard.Bottom && _dailyCard.Left > _trafficCard.Right;
checks["tailnet_show_preserves_scroll"] = _dashboardScrollBar.Value == previous;
checks["tailnet_expanded_history_chart_fills_card"] = _dailyChart.Height > _trafficChart.Height
&& _dailyChart.Bottom < _dailyUploadLegend.Top && _historyStatus.Bottom <= _dailyCard.Height;
var originalProxyValue = _uploadMetric.ValueText;
var originalProxyLegend = _uploadLegend.Text;
var originalSessionUp = _sessionUp;
var originalSessionDown = _sessionDown;
DisplayTailnetTraffic(12345, 67890, "独立 UI 样本");
checks["tailnet_view_never_adds_sample_to_session_totals_again"] = _sessionUp == originalSessionUp
&& _sessionDown == originalSessionDown;
checks["tailnet_values_are_independent_controls"] = _tailnetUploadMetric.ValueText == "12.06"
&& _tailnetDownloadMetric.ValueText == "66.3" && _tailnetUploadMetric.Parent == _tailnetTrafficCard
&& _tailnetDownloadMetric.Parent == _tailnetTrafficCard && _tailnetTrafficChart.Parent == _tailnetTrafficCard
&& _uploadMetric.ValueText == originalProxyValue && _uploadLegend.Text == originalProxyLegend;
checks["tailnet_valid_sample_appends_one_curve_point"] = TailnetPoints() == 1;
checks["tailnet_scope_and_already_accounted_are_explicit"] = _tailnetSampleLabel.Text.StartsWith("仅纵横家链路 · ")
&& _tailnetUploadMetric.Hint == "已计入代理总流量" && _tailnetDownloadMetric.Hint == "已计入代理总流量";
DisplayTailnetTraffic(null, double.NaN, "独立采样不可用");
checks["tailnet_missing_samples_not_total_or_fake_zero"] = _tailnetUploadMetric.ValueText == "—"
&& _tailnetDownloadMetric.ValueText == "—" && _tailnetUploadLegend.Text == "● 上传 —" && TailnetPoints() == 0;
ResetTailnetTraffic();
checks["tailnet_reset_clears_metric_and_sampling"] = _tailnetUploadMetric.ValueText == "—"
&& _tailnetDownloadMetric.ValueText == "—" && _tailnetSampleLabel.Text == "仅纵横家链路 · 等待 Tailscale 流量采样" && TailnetPoints() == 0;
SetTailnetTrafficVisibility(false);
checks["tailnet_hide_restores_exact_original_geometry_without_gap"] = _trafficCard.Bounds == baseTraffic
&& _dailyCard.Bounds == baseDaily && _footer.Bounds == baseFooter && _dashboardBody.Height == baseHeight;
SetTailnetTrafficVisibility(true);
checks["tailnet_resurface_has_no_previous_connection_numbers"] = _tailnetUploadMetric.ValueText == "—"
&& _tailnetDownloadMetric.ValueText == "—" && TailnetPoints() == 0;
Size = MinimumSize;
PerformLayout();
LayoutDashboard();
Application.DoEvents();
checks["tailnet_compact_orders_realtime_tailnet_history"] = _trafficCard.Left == _tailnetTrafficCard.Left
&& _tailnetTrafficCard.Left == _dailyCard.Left && _tailnetTrafficCard.Top > _trafficCard.Bottom
&& _dailyCard.Top > _tailnetTrafficCard.Bottom;
checks["tailnet_all_controls_fit_transparent_cards"] = DashboardControlsFit() && CardPanel.SurfaceAlpha == 128;
var limit = Math.Max(0, _dashboardScrollBar.Maximum - _dashboardScrollBar.LargeChange + 1);
_dashboardScrollBar.Value = limit;
LayoutDashboard();
checks["tailnet_compact_footer_remains_reachable"] = !_dashboardView.HorizontalScroll.Visible
&& _footer.RectangleToScreen(_footer.ClientRectangle).Bottom <= _dashboardView.RectangleToScreen(_dashboardView.ClientRectangle).Bottom;
DisplayTailnetTraffic(1, 2, "独立 UI 样本");
SetTailnetTrafficVisibility(false);
checks["tailnet_hide_clamps_scroll_and_clears_data"] = _dashboardScrollBar.Value <= Math.Max(0,
_dashboardScrollBar.Maximum - _dashboardScrollBar.LargeChange + 1)
&& _tailnetUploadMetric.ValueText == "—" && _tailnetDownloadMetric.ValueText == "—";
UpdateConnectedTransportPresentation(true);
checks["actual_transport_presentation_enables_tailnet_card"] = _currentNodeUsesTailnet && _tailnetTrafficVisible;
UpdateConnectedTransportPresentation(false);
checks["public_transport_presentation_hides_tailnet_card"] = !_currentNodeUsesTailnet && !_tailnetTrafficVisible;
ClientSize = originalSize;
LayoutDashboard();
checks["tailnet_geometry_112_viewport_dpi_cases"] = DashboardLayout.SelfTest();
return checks;
}
}
+49 -9
View File
@@ -146,6 +146,7 @@ internal sealed partial class MainForm
foreach (var metric in new[] { _usageMetric, _sessionMetric, _uploadMetric, _downloadMetric }) metric.Embedded = true; foreach (var metric in new[] { _usageMetric, _sessionMetric, _uploadMetric, _downloadMetric }) metric.Embedded = true;
_trafficCard.Controls.AddRange([_uploadMetric, _downloadMetric]); _trafficCard.Controls.AddRange([_uploadMetric, _downloadMetric]);
_dailyCard.Controls.AddRange([_usageMetric, _sessionMetric]); _dailyCard.Controls.AddRange([_usageMetric, _sessionMetric]);
BuildTailnetTrafficCard();
_dashboardBody.Controls.Add(_footer); _dashboardBody.Controls.Add(_footer);
foreach (var label in new[] { _welcomeLabel, _accountLabel, _statusTitle, _statusDetail, _currentNodeLabel, _planLabel, _expiryLabel }) foreach (var label in new[] { _welcomeLabel, _accountLabel, _statusTitle, _statusDetail, _currentNodeLabel, _planLabel, _expiryLabel })
{ {
@@ -165,13 +166,16 @@ internal sealed partial class MainForm
_sampleLabel.Text = sampling; _sampleLabel.Text = sampling;
_uploadLegend.Text = upload.HasValue ? $"● 上传 {FormatBytes((long)upload.Value)}/s" : "● 上传 —"; _uploadLegend.Text = upload.HasValue ? $"● 上传 {FormatBytes((long)upload.Value)}/s" : "● 上传 —";
_downloadLegend.Text = download.HasValue ? $"● 下载 {FormatBytes((long)download.Value)}/s" : "● 下载 —"; _downloadLegend.Text = download.HasValue ? $"● 下载 {FormatBytes((long)download.Value)}/s" : "● 下载 —";
// Waiting/handover/error paths also invalidate the separate transport
// view. Valid samples are supplied once by the existing traffic reader.
if (!upload.HasValue || !download.HasValue) DisplayTailnetTraffic(null, null, sampling);
} }
private void LayoutDashboard() private void LayoutDashboard()
{ {
if (_layingOutDashboard || _dashboardView.ClientSize.Width <= 0) return; if (_layingOutDashboard || _dashboardView.ClientSize.Width <= 0) return;
_layingOutDashboard = true; _layingOutDashboard = true;
Control[] layoutContainers = [_dashboardView, _dashboardBody, _statusCard, _nodeCard, _modeCard, _trafficCard, _dailyCard, _footer]; Control[] layoutContainers = [_dashboardView, _dashboardBody, _statusCard, _nodeCard, _modeCard, _trafficCard, _tailnetTrafficCard, _dailyCard, _footer];
foreach (var container in layoutContainers) container.SuspendLayout(); foreach (var container in layoutContainers) container.SuspendLayout();
try try
{ {
@@ -179,11 +183,11 @@ internal sealed partial class MainForm
// Explicit vertical canvas: card reflow must never retain a previous // Explicit vertical canvas: card reflow must never retain a previous
// horizontal extent or reset the user's scroll offset on repaint. // horizontal extent or reset the user's scroll offset on repaint.
var viewport = _dashboardView.ClientSize; var viewport = _dashboardView.ClientSize;
var layout = DashboardLayout.Calculate(viewport, DeviceDpi); var layout = DashboardLayout.Calculate(viewport, DeviceDpi, _tailnetTrafficVisible);
_dashboardScrollBar.Visible = layout.ContentHeight > viewport.Height; _dashboardScrollBar.Visible = layout.ContentHeight > viewport.Height;
_dashboardScrollBar.Bounds = new Rectangle(viewport.Width - ScaleLogical(17), 0, ScaleLogical(17), viewport.Height); _dashboardScrollBar.Bounds = new Rectangle(viewport.Width - ScaleLogical(17), 0, ScaleLogical(17), viewport.Height);
if (_dashboardScrollBar.Visible) if (_dashboardScrollBar.Visible)
layout = DashboardLayout.Calculate(new Size(viewport.Width - ScaleLogical(17), viewport.Height), DeviceDpi); layout = DashboardLayout.Calculate(new Size(viewport.Width - ScaleLogical(17), viewport.Height), DeviceDpi, _tailnetTrafficVisible);
void Place(Control c, Rectangle r) { c.Bounds = r; } void Place(Control c, Rectangle r) { c.Bounds = r; }
Rectangle R(int x, int y, int w, int h) => new(ScaleLogical(x), ScaleLogical(y), ScaleLogical(w), ScaleLogical(h)); Rectangle R(int x, int y, int w, int h) => new(ScaleLogical(x), ScaleLogical(y), ScaleLogical(w), ScaleLogical(h));
Place(_welcomeLabel, layout.WelcomeLabel); Place(_accountLabel, layout.AccountLabel); Place(_welcomeLabel, layout.WelcomeLabel); Place(_accountLabel, layout.AccountLabel);
@@ -192,6 +196,7 @@ internal sealed partial class MainForm
var metrics = new[] { _usageMetric, _uploadMetric, _downloadMetric, _sessionMetric }; var metrics = new[] { _usageMetric, _uploadMetric, _downloadMetric, _sessionMetric };
for (var i = 0; i < 4; i++) Place(metrics[i], layout.Metrics[i]); for (var i = 0; i < 4; i++) Place(metrics[i], layout.Metrics[i]);
Place(_trafficCard, layout.TrafficCard); Place(_dailyCard, layout.DailyCard); Place(_footer, layout.Footer); Place(_trafficCard, layout.TrafficCard); Place(_dailyCard, layout.DailyCard); Place(_footer, layout.Footer);
LayoutTailnetTrafficCard(layout.TailnetTrafficCard);
_statusDot.Bounds = R(24, 15, 42, 46); _statusDot.Bounds = R(24, 15, 42, 46);
_connectButton.Bounds = new(_statusCard.Width - ScaleLogical(148), ScaleLogical(17), ScaleLogical(130), ScaleLogical(42)); _connectButton.Bounds = new(_statusCard.Width - ScaleLogical(148), ScaleLogical(17), ScaleLogical(130), ScaleLogical(42));
@@ -216,13 +221,14 @@ internal sealed partial class MainForm
_dailyHeading.Bounds = new(ScaleLogical(42), ScaleLogical(8), _dailyCard.Width - ScaleLogical(180), ScaleLogical(26)); _dailyHeading.Bounds = new(ScaleLogical(42), ScaleLogical(8), _dailyCard.Width - ScaleLogical(180), ScaleLogical(26));
_historyRangeCombo.Bounds = new(_dailyCard.Width - ScaleLogical(140), ScaleLogical(10), ScaleLogical(124), ScaleLogical(26)); _historyRangeCombo.Bounds = new(_dailyCard.Width - ScaleLogical(140), ScaleLogical(10), ScaleLogical(124), ScaleLogical(26));
_trafficChart.Bounds = new(ScaleLogical(13), ScaleLogical(132), _trafficCard.Width - ScaleLogical(26), ScaleLogical(106)); _trafficChart.Bounds = new(ScaleLogical(13), ScaleLogical(132), _trafficCard.Width - ScaleLogical(26), ScaleLogical(106));
_dailyChart.Bounds = new(ScaleLogical(13), ScaleLogical(132), _dailyCard.Width - ScaleLogical(26), ScaleLogical(106)); _dailyChart.Bounds = new(ScaleLogical(13), ScaleLogical(132), _dailyCard.Width - ScaleLogical(26), _dailyCard.Height - ScaleLogical(170));
var legendWidth = (_trafficCard.Width - ScaleLogical(40)) / 2; var legendWidth = (_trafficCard.Width - ScaleLogical(40)) / 2;
_uploadLegend.Bounds = new(ScaleLogical(20), ScaleLogical(248), legendWidth, ScaleLogical(19)); _uploadLegend.Bounds = new(ScaleLogical(20), ScaleLogical(248), legendWidth, ScaleLogical(19));
_downloadLegend.Bounds = new(ScaleLogical(20) + legendWidth, ScaleLogical(248), legendWidth, ScaleLogical(19)); _downloadLegend.Bounds = new(ScaleLogical(20) + legendWidth, ScaleLogical(248), legendWidth, ScaleLogical(19));
_dailyUploadLegend.Bounds = new(ScaleLogical(20), ScaleLogical(248), ScaleLogical(52), ScaleLogical(19)); var dailyLegendTop = _dailyCard.Height - ScaleLogical(28);
_dailyDownloadLegend.Bounds = new(ScaleLogical(76), ScaleLogical(248), ScaleLogical(52), ScaleLogical(19)); _dailyUploadLegend.Bounds = new(ScaleLogical(20), dailyLegendTop, ScaleLogical(52), ScaleLogical(19));
_historyStatus.Bounds = new(ScaleLogical(134), ScaleLogical(248), _dailyCard.Width - ScaleLogical(148), ScaleLogical(19)); _dailyDownloadLegend.Bounds = new(ScaleLogical(76), dailyLegendTop, ScaleLogical(52), ScaleLogical(19));
_historyStatus.Bounds = new(ScaleLogical(134), dailyLegendTop, _dailyCard.Width - ScaleLogical(148), ScaleLogical(19));
_planLabel.Bounds = R(0, 4, 300, 26); _planLabel.Bounds = R(0, 4, 300, 26);
_expiryLabel.Bounds = R(306, 4, 132, 26); _expiryLabel.Bounds = R(306, 4, 132, 26);
_footerCompanyLogo.Bounds = R(0, 34, 32, 34); _footerCompanyLogo.Bounds = R(0, 34, 32, 34);
@@ -278,7 +284,7 @@ internal sealed partial class MainForm
for (var i = 0; i < 60; i++) form._trafficChart.Add((i % 13 == 0 ? 72 : 8 + Math.Sin(i * 1.8) * 4) * 1024, for (var i = 0; i < 60; i++) form._trafficChart.Add((i % 13 == 0 ? 72 : 8 + Math.Sin(i * 1.8) * 4) * 1024,
(i % 9 == 2 ? 130 : 10 + Math.Sin(i * 2.4) * 8) * 1024, DateTimeOffset.Now.AddSeconds((i - 59) * 5)); (i % 9 == 2 ? 130 : 10 + Math.Sin(i * 2.4) * 8) * 1024, DateTimeOffset.Now.AddSeconds((i - 59) * 5));
form.LayoutBrandHeader(); form.LayoutDashboard(); form.LayoutBrandHeader(); form.LayoutDashboard();
var checks = new Dictionary<string, bool> { ["geometry_56_viewport_dpi_cases"] = DashboardLayout.SelfTest() }; var checks = new Dictionary<string, bool> { ["geometry_112_viewport_dpi_cases"] = DashboardLayout.SelfTest() };
foreach (var check in UsageHistorySeries.SelfTest()) checks[check.Key] = check.Value; foreach (var check in UsageHistorySeries.SelfTest()) checks[check.Key] = check.Value;
void Capture(string suffix) void Capture(string suffix)
{ {
@@ -358,6 +364,39 @@ internal sealed partial class MainForm
form.SetConnectionState(true, "已安全连接", "手动指定节点 · AI 智能代理"); form.SetConnectionState(true, "已安全连接", "手动指定节点 · AI 智能代理");
Capture("manual-connected"); Capture("manual-connected");
checks["manual_connected_selection_locked"] = !form._connectionModeCombo.Enabled && !form._manualNodeCombo.Visible; checks["manual_connected_selection_locked"] = !form._connectionModeCombo.Enabled && !form._manualNodeCombo.Visible;
// Synthetic preview of the same already-accounted proxy sample on a
// Tailnet connection. Use a taller fixture to show both left cards;
// this does not change the production window size or claim live data.
form._connectionModeCombo.SelectedIndex = 0;
form._currentNodeBaseName = "VPN003";
form.UpdateConnectedTransportPresentation(true);
form.SetConnectionState(true, "已安全连接", form._currentNodeName + " · AI 智能代理");
form._currentNodeLabel.Text = form._currentNodeName;
form._dailyChart.SetHistory([], fixtureRanges);
form.ClientSize = new Size(form.ScaleLogical(900), form.ScaleLogical(1020));
form._trafficChart.Reset();
form.ResetTailnetTraffic();
for (var i = 0; i < 60; i++)
{
var up = (i % 13 == 0 ? 72 : 8 + Math.Sin(i * 1.8) * 4) * 1024;
var down = (i % 9 == 2 ? 130 : 10 + Math.Sin(i * 2.4) * 8) * 1024;
var sampledAt = DateTimeOffset.Now.AddSeconds((i - 59) * 5);
form._trafficChart.Add(up, down, sampledAt);
form._tailnetTrafficChart.Add(up, down, sampledAt);
}
form.DisplayTraffic(23842, 89312, "演示样本 · 近 5 分钟");
form.DisplayTailnetTraffic(23842, 89312, "演示样本 · 近 5 分钟");
Capture("tailnet-dashboard");
checks["tailnet_wide_preview_has_left_two_right_one"] = form._dailyCard.Top == form._trafficCard.Top
&& form._dailyCard.Bottom == form._tailnetTrafficCard.Bottom;
form.Size = form.MinimumSize;
Capture("tailnet-compact");
form._dashboardScrollBar.Value = Math.Max(0, form._dashboardScrollBar.Maximum - form._dashboardScrollBar.LargeChange + 1);
Capture("tailnet-compact-scrolled");
checks["tailnet_compact_preview_footer_reachable"] = form._footer.RectangleToScreen(form._footer.ClientRectangle).Bottom
<= form._dashboardView.RectangleToScreen(form._dashboardView.ClientRectangle).Bottom;
form.SetTailnetTrafficVisibility(false);
form.ClientSize = new Size(form.ScaleLogical(900), form.ScaleLogical(640));
form.ShowLogin(); Capture("login"); form.ShowLogin(); Capture("login");
checks["login_fields_visible"] = form.LoginFieldsVisibleForTest; checks["login_fields_visible"] = form.LoginFieldsVisibleForTest;
File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "dashboard-ui-self-test.json"), JsonSerializer.Serialize(new File.WriteAllText(Path.Combine(AppContext.BaseDirectory, "dashboard-ui-self-test.json"), JsonSerializer.Serialize(new
@@ -369,6 +408,7 @@ internal sealed partial class MainForm
if (checks.Values.Any(v => !v)) throw new InvalidOperationException("Dashboard UI self-test failed; inspect dashboard-ui-self-test.json"); if (checks.Values.Any(v => !v)) throw new InvalidOperationException("Dashboard UI self-test failed; inspect dashboard-ui-self-test.json");
} }
private bool DashboardControlsFit() => new Control[] { _statusCard, _nodeCard, _modeCard, _trafficCard, _dailyCard, _footer } private bool DashboardControlsFit() => new Control[] { _statusCard, _nodeCard, _modeCard, _trafficCard, _tailnetTrafficCard, _dailyCard, _footer }
.Where(parent => parent.Visible)
.All(parent => parent.Controls.Cast<Control>().Where(c => c.Visible).All(c => c.Left >= 0 && c.Top >= 0 && c.Right <= parent.ClientSize.Width && c.Bottom <= parent.ClientSize.Height)); .All(parent => parent.Controls.Cast<Control>().Where(c => c.Visible).All(c => c.Left >= 0 && c.Top >= 0 && c.Right <= parent.ClientSize.Width && c.Bottom <= parent.ClientSize.Height));
} }
+1
View File
@@ -19,6 +19,7 @@ internal sealed partial class MainForm
_currentNodeUsesTailnet = usesTailnet; _currentNodeUsesTailnet = usesTailnet;
_currentNodeName = _currentNodeBaseName is null ? null _currentNodeName = _currentNodeBaseName is null ? null
: NodePresentation.WithTransport(_currentNodeBaseName, _currentNodeUsesTailnet); : NodePresentation.WithTransport(_currentNodeBaseName, _currentNodeUsesTailnet);
SetTailnetTrafficVisibility(usesTailnet);
} }
private void BuildConnectionSelection() private void BuildConnectionSelection()
+82
View File
@@ -0,0 +1,82 @@
namespace UCVL.VPNPlus;
internal sealed partial class MainForm
{
// Presentation only. These controls never read adapter/counter state and
// never change proxy, account, session totals or route decisions.
private readonly CardPanel _tailnetTrafficCard = new() { MetricBand = true };
private readonly MetricCard _tailnetUploadMetric = new("上传速度", DashboardIcon.Upload) { Embedded = true };
private readonly MetricCard _tailnetDownloadMetric = new("下载速度", DashboardIcon.Download) { Embedded = true };
private readonly TrafficChart _tailnetTrafficChart = new();
private readonly DashboardGlyph _tailnetTrafficIcon = new(DashboardIcon.Chart);
private readonly Label _tailnetTrafficHeading = new(), _tailnetSampleLabel = new();
private readonly Label _tailnetUploadLegend = new(), _tailnetDownloadLegend = new();
private bool _tailnetTrafficVisible;
private void BuildTailnetTrafficCard()
{
ConfigureLabel(_tailnetTrafficHeading, "Tailscale 实时网速", Brand.Font(9.5f, FontStyle.Bold), Brand.Text);
ConfigureLabel(_tailnetSampleLabel, "等待流量采样", Brand.Font(7.5f), Brand.Muted);
_tailnetSampleLabel.TextAlign = ContentAlignment.MiddleRight;
_tailnetSampleLabel.AutoEllipsis = true;
ConfigureLabel(_tailnetUploadLegend, "● 上传 —", Brand.Font(8), Brand.RoyalBlue);
ConfigureLabel(_tailnetDownloadLegend, "● 下载 —", Brand.Font(8), Brand.Cyan);
_tailnetTrafficCard.AccessibleName = "Tailscale 实时网速";
_tailnetTrafficCard.AccessibleDescription = "仅纵横家当前 Tailscale 代理链路;已计入代理总流量,不代表所有 Tailscale 网卡或整机流量。";
_tailnetTrafficCard.Controls.AddRange([_tailnetTrafficIcon, _tailnetTrafficHeading, _tailnetSampleLabel,
_tailnetUploadMetric, _tailnetDownloadMetric, _tailnetTrafficChart, _tailnetUploadLegend, _tailnetDownloadLegend]);
_tailnetTrafficCard.Visible = false;
_dashboardBody.Controls.Add(_tailnetTrafficCard);
ResetTailnetTraffic();
}
internal void SetTailnetTrafficVisibility(bool show)
{
if (_tailnetTrafficVisible == show) return;
_tailnetTrafficVisible = show;
_tailnetTrafficCard.Visible = show;
if (!show) ResetTailnetTraffic();
LayoutDashboard();
}
internal void DisplayTailnetTraffic(double? up, double? down, string sampling)
{
// Root supplies the already-accounted proxy sample only for the active
// Tailnet transport. This presentation never reads an adapter or adds
// bytes to session/backend totals. Missing samples are not fake zeroes.
static double? Clean(double? value) => value.HasValue && double.IsFinite(value.Value)
? Math.Max(0, value.Value) : null;
up = Clean(up); down = Clean(down);
_tailnetUploadMetric.SetBytes(up, speed: true, hint: "已计入代理总流量");
_tailnetDownloadMetric.SetBytes(down, speed: true, hint: "已计入代理总流量");
_tailnetSampleLabel.Text = "仅纵横家链路 · " + sampling;
_tailnetUploadLegend.Text = up.HasValue ? $"● 上传 {FormatBytes((long)up.Value)}/s" : "● 上传 —";
_tailnetDownloadLegend.Text = down.HasValue ? $"● 下载 {FormatBytes((long)down.Value)}/s" : "● 下载 —";
if (up.HasValue && down.HasValue) _tailnetTrafficChart.Add(up.Value, down.Value);
else _tailnetTrafficChart.Reset();
}
internal void ResetTailnetTraffic()
{
_tailnetTrafficChart.Reset();
DisplayTailnetTraffic(null, null, "等待 Tailscale 流量采样");
}
private void LayoutTailnetTrafficCard(Rectangle bounds)
{
_tailnetTrafficCard.Visible = _tailnetTrafficVisible;
if (!_tailnetTrafficVisible) { _tailnetTrafficCard.Bounds = Rectangle.Empty; return; }
_tailnetTrafficCard.Bounds = bounds;
int S(int value) => ScaleLogical(value);
_tailnetTrafficIcon.Bounds = new Rectangle(S(15), S(10), S(20), S(20));
_tailnetTrafficHeading.Bounds = new Rectangle(S(42), S(8), S(132), S(26));
_tailnetSampleLabel.Bounds = new Rectangle(S(178), S(10), Math.Max(1, bounds.Width - S(192)), S(22));
var metricWidth = (bounds.Width - S(28)) / 2;
_tailnetUploadMetric.Bounds = new Rectangle(S(14), S(43), metricWidth - S(2), S(82));
_tailnetDownloadMetric.Bounds = new Rectangle(S(14) + metricWidth, S(43), metricWidth - S(2), S(82));
_tailnetTrafficChart.Bounds = new Rectangle(S(13), S(132), bounds.Width - S(26), S(106));
var legendWidth = (bounds.Width - S(40)) / 2;
_tailnetUploadLegend.Bounds = new Rectangle(S(20), S(248), legendWidth, S(19));
_tailnetDownloadLegend.Bounds = new Rectangle(S(20) + legendWidth, S(248), legendWidth, S(19));
}
}
+12 -2
View File
@@ -501,7 +501,7 @@ internal sealed partial class MainForm : Form
_connectionHealth.Invalidate(); _connectionHealth.Invalidate();
_nextReconnect = DateTimeOffset.MinValue; _nextReconnect = DateTimeOffset.MinValue;
_wantConnected = true; _wantConnected = true;
if (!reconnect) { _transportRetryNodeSlug = null; _failedNodes.Clear(); _sessionUp = _sessionDown = 0; _trafficChart.Reset(); _sessionMetric.SetBytes(0, hint: "本次连接累计"); } if (!reconnect) { _transportRetryNodeSlug = null; _failedNodes.Clear(); _sessionUp = _sessionDown = 0; _trafficChart.Reset(); ResetTailnetTraffic(); _sessionMetric.SetBytes(0, hint: "本次连接累计"); }
foreach (var slug in _failedNodes.Where(p => p.Value <= DateTimeOffset.UtcNow).Select(p => p.Key).ToList()) _failedNodes.Remove(slug); foreach (var slug in _failedNodes.Where(p => p.Value <= DateTimeOffset.UtcNow).Select(p => p.Key).ToList()) _failedNodes.Remove(slug);
SetConnectionState(false, "正在连接", selection.Manual ? "正在连接手动指定节点…" : "vpn-ai 正在分配工作节点…"); SetConnectionState(false, "正在连接", selection.Manual ? "正在连接手动指定节点…" : "vpn-ai 正在分配工作节点…");
var replacementStarted = false; var replacementStarted = false;
@@ -656,6 +656,7 @@ internal sealed partial class MainForm : Form
_currentNodeIsPrivateAuxiliary = false; _currentNodeIsPrivateAuxiliary = false;
_currentPrivateEndpoint = null; _currentPrivateEndpoint = null;
_currentNodeUsesTailnet = false; _currentNodeUsesTailnet = false;
SetTailnetTrafficVisibility(false);
_transportRetryNodeSlug = null; _transportRetryNodeSlug = null;
_privateLeaseDeadlineTicks = 0; _privateLeaseDeadlineTicks = 0;
_currentNodeName = null; _currentNodeName = null;
@@ -674,7 +675,11 @@ internal sealed partial class MainForm : Form
{ {
var core = _xray.CoreId; var core = _xray.CoreId;
var counters = await _xray.ReadTrafficAsync(_lifetime.Token); var counters = await _xray.ReadTrafficAsync(_lifetime.Token);
if (counters is null || core != _xray.CoreId) { DisplayTraffic(null, null, "采样暂不可用"); return; } if (counters is null || core != _xray.CoreId)
{
DisplayTraffic(null, null, "采样暂不可用");
return;
}
var now = DateTimeOffset.UtcNow; var now = DateTimeOffset.UtcNow;
if (core != _lastCoreId) { _lastCoreId = core ?? 0; _lastUp = _lastDown = 0; _lastSample = now.AddSeconds(-5); } if (core != _lastCoreId) { _lastCoreId = core ?? 0; _lastUp = _lastDown = 0; _lastSample = now.AddSeconds(-5); }
var seconds = Math.Max(0.1, (now-_lastSample).TotalSeconds); var seconds = Math.Max(0.1, (now-_lastSample).TotalSeconds);
@@ -685,6 +690,11 @@ internal sealed partial class MainForm : Form
DisplayTraffic(up / seconds, down / seconds, $"{now.LocalDateTime:HH:mm:ss} · 近 5 分钟"); DisplayTraffic(up / seconds, down / seconds, $"{now.LocalDateTime:HH:mm:ss} · 近 5 分钟");
_sessionMetric.SetBytes(_sessionUp + _sessionDown, hint: "本次连接累计"); _sessionMetric.SetBytes(_sessionUp + _sessionDown, hint: "本次连接累计");
_trafficChart.Add(up/seconds, down/seconds); _trafficChart.Add(up/seconds, down/seconds);
// This is a view of the SAME proxy sample, not a second counter.
// A single connected proxy uses either its Tailnet or public ingress.
// Do not read the whole Tailscale adapter or add this subset to usage.
if (_currentNodeUsesTailnet)
DisplayTailnetTraffic(up / seconds, down / seconds, $"{now.LocalDateTime:HH:mm:ss} · 近 5 分钟");
} }
catch (OperationCanceledException) { } catch (OperationCanceledException) { }
catch (Exception exception) { AppPaths.WriteError(exception); } catch (Exception exception) { AppPaths.WriteError(exception); }
+4 -2
View File
@@ -1,6 +1,6 @@
# 纵横家 Windows 0.2.22 开源源码 # 纵横家 Windows 0.2.23 开源源码
基于已冻结的 0.2.22 r2 第一方 Windows Forms / .NET 8 源码整理。此导出不是原安装包的逐字节副本:删除许可来源不明的可选登录插图及内部运维历史,保留原创山水缺图 fallback;端点为示例配置。原候选测试报告不能当作本导出的构建或生产验收证明。 基于已冻结的 0.2.23 r2 第一方 Windows Forms / .NET 8 源码整理。此导出不是原安装包的逐字节副本:删除许可来源不明的可选登录插图及内部运维历史,保留原创山水缺图 fallback;端点为示例配置。原候选测试报告不能当作本导出的构建或生产验收证明。
## 构建 ## 构建
@@ -18,3 +18,5 @@ dotnet publish VPNPlus.csproj -c Release -r win-x64 --self-contained true
公司自有代码适用 LICENSE;公司 Logo/商标保留来源识别用途、不授予品牌权利;第三方许可文本在 licenses/ 中,原 THIRD_PARTY_NOTICES.md 保持原文。 公司自有代码适用 LICENSE;公司 Logo/商标保留来源识别用途、不授予品牌权利;第三方许可文本在 licenses/ 中,原 THIRD_PARTY_NOTICES.md 保持原文。
本次只同步Windows界面维护代码:滚动/刷新、托盘与透明卡片。清洁导出继续省略可选登录人物插图,使用已有原创山水fallback;未重新导出或修改其它平台。安装包发布证据不能转移为此脱敏源码的构建/真实网络验收。 本次只同步Windows界面维护代码:滚动/刷新、托盘与透明卡片。清洁导出继续省略可选登录人物插图,使用已有原创山水fallback;未重新导出或修改其它平台。安装包发布证据不能转移为此脱敏源码的构建/真实网络验收。
新增条件 Tailscale 实时卡,内网左二右一,公网隐藏;仅已有代理总量分项,不重复累计。源码仍省略许可不明可选人物插图。
+4 -4
View File
@@ -10,10 +10,10 @@
<ApplicationIcon>assets\zonghengjia-app-v1.ico</ApplicationIcon> <ApplicationIcon>assets\zonghengjia-app-v1.ico</ApplicationIcon>
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode> <ApplicationHighDpiMode>PerMonitorV2</ApplicationHighDpiMode>
<Version>0.2.22</Version> <Version>0.2.23</Version>
<AssemblyVersion>0.2.22.0</AssemblyVersion> <AssemblyVersion>0.2.23.0</AssemblyVersion>
<FileVersion>0.2.22.0</FileVersion> <FileVersion>0.2.23.0</FileVersion>
<InformationalVersion>0.2.22</InformationalVersion> <InformationalVersion>0.2.23</InformationalVersion>
<Product>纵横家</Product> <Product>纵横家</Product>
<Company>优创未来(UCVL)</Company> <Company>优创未来(UCVL)</Company>
<Description>纵横家 Windows 智能网络客户端</Description> <Description>纵横家 Windows 智能网络客户端</Description>
+8
View File
@@ -0,0 +1,8 @@
# 纵横家 Windows 0.2.23
- 实际使用 Tailscale 时,左侧原实时网速下方增加 Tailscale 实时上传、下载和曲线;右侧代理流量跨两行。
- 公网连接隐藏 Tailscale 卡片并恢复原布局,不留空白;窄窗口保持纵向滚动。
- Tailscale 卡展示本软件已计入代理总量的链路分项,不重复累计,不代表整机或其它应用的 Tailscale 网卡流量。
- 断开、切换公网或无有效采样时清除旧值。保留现有 Tailscale 优先、同节点公网回退及安装升级逻辑。
Windows x64 非强制维护更新,需管理员授权,安装包未签名。本包离线界面与隔离安装检查不等于生产实窗、新版真实长连接或所有用户均已升级。其它平台不随本次 Windows 版本发布。