不代理TCP流量设置

调整设置界面UI
This commit is contained in:
AmazingDM
2021-01-04 13:23:58 +08:00
parent 4c8508a838
commit ce15e9468e
5 changed files with 240 additions and 269 deletions

View File

@@ -55,8 +55,11 @@ namespace Netch.Controllers
#region aio_dial
aio_dial((int) NameList.TYPE_FILTERLOOPBACK, "false");
aio_dial((int) NameList.TYPE_FILTERTCP, "true");
aio_dial((int) NameList.TYPE_TCPLISN, Global.Settings.RedirectorTCPPort.ToString());
if (Global.Settings.ProcessNoProxyForUdp && Global.Settings.ProcessNoProxyForTcp) MessageBoxX.Show("");
//UDP
if (Global.Settings.ProcessNoProxyForUdp)
{
aio_dial((int) NameList.TYPE_FILTERUDP, "false");
@@ -68,6 +71,18 @@ namespace Netch.Controllers
SetServer(PortType.Both);
}
//TCP
if (Global.Settings.ProcessNoProxyForTcp)
{
aio_dial((int) NameList.TYPE_FILTERTCP, "false");
SetServer(PortType.UDP);
}
else
{
aio_dial((int) NameList.TYPE_FILTERTCP, "true");
SetServer(PortType.Both);
}
if (!CheckRule(mode.FullRule, out var list))
{
MessageBoxX.Show($"\"{string.Join("", list.Select(s => s + "\n"))}\" does not conform to C++ regular expression syntax");

File diff suppressed because it is too large Load Diff

View File

@@ -105,6 +105,10 @@ namespace Netch.Forms
s => Global.Settings.ProcessNoProxyForUdp = s,
Global.Settings.ProcessNoProxyForUdp);
BindCheckBox(NoProxyForTcpCheckBox,
s => Global.Settings.ProcessNoProxyForTcp = s,
Global.Settings.ProcessNoProxyForTcp);
#endregion
#region TUN/TAP
@@ -310,10 +314,11 @@ namespace Netch.Forms
return;
}
#endregion
#region CheckSTUN
var stunFlag = true;
var errFlag = false;
var stunServer = string.Empty;
ushort stunServerPort = 3478;
@@ -325,15 +330,15 @@ namespace Netch.Forms
if (stun.Length > 1)
if (!ushort.TryParse(stun[1], out stunServerPort))
{
stunFlag = false;
errFlag = true;
}
}
else
{
stunFlag = false;
errFlag = true;
}
if (!stunFlag)
if (errFlag)
{
Utils.Utils.ChangeControlForeColor(STUN_ServerComboBox, Color.Red);
return;
@@ -341,6 +346,15 @@ namespace Netch.Forms
#endregion
#region CheckProcessMode
if (NoProxyForUdpCheckBox.Checked && NoProxyForTcpCheckBox.Checked)
{
Utils.Utils.ChangeControlForeColor(STUN_ServerComboBox, Color.Red);
MessageBoxX.Show("TCP&UDP只允许勾选一个");
return;
}
#endregion
#region Save

View File

@@ -87,6 +87,11 @@ namespace Netch.Models
/// </summary>
public class Setting
{
public V2rayConfig V2RayConfig = new V2rayConfig();
public AioDNSConfig AioDNS = new AioDNSConfig();
/// <summary>
/// 服务器选择位置
/// </summary>
@@ -267,12 +272,19 @@ namespace Netch.Models
/// </summary>
public string Language = "System";
public V2rayConfig V2RayConfig = new V2rayConfig();
public AioDNSConfig AioDNS = new AioDNSConfig();
/// <summary>
/// 是否使用RDR内置SS
/// </summary>
public bool RedirectorSS = false;
/// <summary>
/// 不代理UDP
/// </summary>
public bool ProcessNoProxyForUdp = false;
/// <summary>
/// 不代理TCP
/// </summary>
public bool ProcessNoProxyForTcp = false;
}
}

View File

@@ -162,6 +162,7 @@
"SS DLL": "SS DLL",
"Modify System DNS": "修改系统 DNS",
"No Proxy for Udp": "不代理Udp流量",
"No Proxy for Tcp": "不代理Tcp流量",
"ProfileCount": "快捷配置数量",
"ProfileCount value illegal. Try again.": "快捷配置数值非法。请重试。",
"STUN_ServerPort value illegal. Try again.": "STUN 端口数值非法。请重试。",