mirror of
https://github.com/netchx/netch.git
synced 2026-05-11 23:45:06 +08:00
refactor: mode match
This commit is contained in:
@@ -39,13 +39,7 @@ namespace Netch.Models
|
||||
_ => false
|
||||
};
|
||||
|
||||
public bool TestNatRequired => Type switch
|
||||
{
|
||||
0 => true,
|
||||
1 => true,
|
||||
2 => true,
|
||||
_ => false
|
||||
};
|
||||
public bool TestNatRequired => Type is 0 or 1 or 2;
|
||||
|
||||
/// <summary>
|
||||
/// 绕过中国(0. 不绕过 1. 绕过)
|
||||
|
||||
@@ -77,21 +77,24 @@ namespace Netch.Servers.VMess.Utils
|
||||
|
||||
if (mode.BypassChina)
|
||||
{
|
||||
if (mode.Type > 2)
|
||||
switch (mode.Type)
|
||||
{
|
||||
directRuleObject.domain.Add("geosite:cn");
|
||||
}
|
||||
|
||||
if (mode.Type == 1 || mode.Type == 2)
|
||||
{
|
||||
if (Global.Flags.SupportFakeDns && Global.Settings.TUNTAP.UseFakeDNS)
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
case 2:
|
||||
if (Global.Flags.SupportFakeDns && Global.Settings.TUNTAP.UseFakeDNS)
|
||||
directRuleObject.domain.Add("geosite:cn");
|
||||
else
|
||||
directRuleObject.ip.Add("geoip:cn");
|
||||
break;
|
||||
default:
|
||||
directRuleObject.domain.Add("geosite:cn");
|
||||
else
|
||||
directRuleObject.ip.Add("geoip:cn");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (mode.Type <= 2)
|
||||
if (mode.Type is 0 or 1 or 2)
|
||||
{
|
||||
blockRuleObject.ip.Add("geoip:private");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user