实现 .NET 10 托盘版网关保活
包含分层探测、可补偿的 IPv4 路由/DNS 切换、自动策略、托盘与分组设置界面、只读诊断工具、离线测试和发布脚本。
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using GatewayKeepalive.Windows;
|
||||
|
||||
namespace GatewayKeepalive.Tests;
|
||||
|
||||
internal static class NativeLayoutTests
|
||||
{
|
||||
public static Task X64LayoutAsync()
|
||||
{
|
||||
Check.Equal(8, IntPtr.Size, "Native layout assertions require the x64 test host");
|
||||
var layout = WindowsNetworkBackend.NativeLayout();
|
||||
var properties = layout.GetType().GetProperties().ToDictionary(property => property.Name, property => property.GetValue(layout));
|
||||
|
||||
int Read(string name)
|
||||
{
|
||||
Check.True(properties.TryGetValue(name, out var value), $"NativeLayout should expose {name}");
|
||||
return (int)value!;
|
||||
}
|
||||
|
||||
Check.Equal(104, Read("RouteSize"), "MIB_IPFORWARD_ROW2 x64 size");
|
||||
Check.Equal(168, Read("InterfaceSize"), "MIB_IPINTERFACE_ROW x64 size");
|
||||
Check.Equal(64, Read("DnsSize"), "DNS_SETTINGS x64 size");
|
||||
Check.Equal(84, Read("RouteMetricOffset"), "MIB_IPFORWARD_ROW2 metric offset");
|
||||
Check.Equal(148, Read("InterfaceMetricOffset"), "MIB_IPINTERFACE_ROW metric offset");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user