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
+23
View File
@@ -1,3 +1,4 @@
using System.Net;
using System.Text.Json;
namespace UCVL.VPNPlus;
@@ -38,6 +39,28 @@ internal static class RouteLeaseSelfTest
var report = new Dictionary<string, object>();
try
{
var gateway = IPAddress.Parse("192.168.1.1");
var physical = new TunRouting.PhysicalNetwork("Fixture Ethernet", 10, IPAddress.Parse("192.168.1.20"),
24, gateway, [gateway]);
var management = new Ipv4Route("47.104.134.190", "255.255.255.255", "192.168.1.1", 10);
var tailnet = new Ipv4Route("100.99.142.38", "255.255.255.255", "0.0.0.0", 30);
var protectedRoutes = TunRouting.CreateOwnedRoutes(physical, [IPAddress.Parse(tailnet.Destination)], 20, preserveProxyRoute: true);
var publicRoutes = TunRouting.CreateOwnedRoutes(physical, [IPAddress.Parse(management.Destination)], 20, preserveProxyRoute: false);
report["management_ipv4_bypasses_tun_in_all_modes"] =
protectedRoutes.Count(management.SamePath) == 1 && publicRoutes.Count(management.SamePath) == 1
&& protectedRoutes.SkipLast(2).All(r => r.InterfaceIndex == physical.InterfaceIndex)
&& protectedRoutes.TakeLast(2).SequenceEqual(split);
report["tailscale_and_private_proxy_routes_are_not_replaced"] =
protectedRoutes.All(r => r.Destination != tailnet.Destination)
&& !TunRouting.CreateOwnedRoutes(physical, [IPAddress.Parse("172.16.0.111")], 20, preserveProxyRoute: true)
.Any(r => r.Destination == "172.16.0.111");
table.Routes.AddRange([tailnet, management]);
await lease.ApplyAsync(protectedRoutes, CancellationToken.None);
await lease.RestoreAsync(CancellationToken.None);
report["existing_management_and_tailnet_paths_survive_cleanup"] = table.Routes.SequenceEqual([tailnet, management]);
table.Routes.Clear();
table.AddCount = 0;
table.Routes.Add(original);
table.FailAdd = 1;
try { await lease.ApplyAsync(new[] { original }.Concat(split), CancellationToken.None); }