mirror of
https://github.com/netchx/netch.git
synced 2026-04-01 19:15:09 +08:00
Optimize TUN/TAP network card priority processing
This commit is contained in:
@@ -100,19 +100,20 @@ namespace Netch.Controllers
|
||||
|
||||
if (SavedMode.Type == 2) // 处理仅规则内走直连
|
||||
{
|
||||
// 将TAP网卡权重放到最高
|
||||
Instance = new Process()
|
||||
// 将 TUN/TAP 网卡权重放到最高
|
||||
var instance = new Process()
|
||||
{
|
||||
StartInfo =
|
||||
{
|
||||
FileName = String.Format("netsh"),
|
||||
Arguments = String.Format("interface ip set interface {0} metric=0",Global.TUNTAP.Index),
|
||||
Arguments = String.Format("interface ip set interface {0} metric=0", Global.TUNTAP.Index),
|
||||
WindowStyle = ProcessWindowStyle.Hidden,
|
||||
UseShellExecute = true,
|
||||
CreateNoWindow = true
|
||||
}
|
||||
};
|
||||
Instance.Start();
|
||||
instance.Start();
|
||||
|
||||
// 创建默认路由
|
||||
if (!NativeMethods.CreateRoute("0.0.0.0", 0, Global.Settings.TUNTAP.Gateway, Global.TUNTAP.Index, 10))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user