diff --git a/Netch/Controllers/NFController.cs b/Netch/Controllers/NFController.cs
index 50373f43..4c1f3fd4 100644
--- a/Netch/Controllers/NFController.cs
+++ b/Netch/Controllers/NFController.cs
@@ -37,7 +37,7 @@ public class NFController : IModeController
Dial(NameList.AIO_FILTERLOOPBACK, _mode.FilterLoopback);
Dial(NameList.AIO_FILTERINTRANET, _mode.FilterIntranet);
- Dial(NameList.AIO_FILTERPARENT, _mode.FilterParent ?? _rdrConfig.HandleOnlyDNS);
+ Dial(NameList.AIO_FILTERPARENT, _mode.FilterParent ?? _rdrConfig.FilterParent);
Dial(NameList.AIO_FILTERICMP, _mode.FilterICMP ?? _rdrConfig.FilterICMP);
if (_mode.FilterICMP ?? _rdrConfig.FilterICMP)
Dial(NameList.AIO_ICMPING, (_mode.FilterICMP != null ? _mode.ICMPDelay ?? 10 : _rdrConfig.ICMPDelay).ToString());
diff --git a/Netch/Controllers/PcapController.cs b/Netch/Controllers/PcapController.cs
index e5338b67..3c31d4af 100644
--- a/Netch/Controllers/PcapController.cs
+++ b/Netch/Controllers/PcapController.cs
@@ -26,7 +26,7 @@ public class PcapController : Guard, IModeController
public override string Name => "pcap2socks";
- public ModeFeature Features => 0;
+ public ModeFeature Features => ModeFeature.SupportSocks5Auth;
public async Task StartAsync(Socks5Server server, Mode mode)
{
diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs
index 07550f64..97d896a4 100644
--- a/Netch/Forms/SettingForm.cs
+++ b/Netch/Forms/SettingForm.cs
@@ -107,7 +107,7 @@ public partial class SettingForm : BindingForm
BindCheckBox(UseCustomDNSCheckBox, b => { Global.Settings.TUNTAP.UseCustomDNS = b; }, Global.Settings.TUNTAP.UseCustomDNS);
BindTextBox(TUNTAPDNSTextBox,
- s => true,
+ s => UseCustomDNSCheckBox.Checked ? IPAddress.TryParse(s, out _) : true,
s =>
{
if (UseCustomDNSCheckBox.Checked)
diff --git a/Netch/Utils/DnsUtils.cs b/Netch/Utils/DnsUtils.cs
index 935d9014..67631d13 100644
--- a/Netch/Utils/DnsUtils.cs
+++ b/Netch/Utils/DnsUtils.cs
@@ -1,11 +1,14 @@
using System.Collections;
using System.Net;
using System.Net.Sockets;
+using Microsoft.VisualStudio.Threading;
namespace Netch.Utils;
public static class DnsUtils
{
+ private static readonly AsyncSemaphore Lock = new(1);
+
///
/// 缓存
///
@@ -14,6 +17,7 @@ public static class DnsUtils
public static async Task LookupAsync(string hostname, AddressFamily inet = AddressFamily.Unspecified, int timeout = 3000)
{
+ using var _ = await Lock.EnterAsync();
try
{
var cacheResult = inet switch
diff --git a/Netch/Utils/Utils.cs b/Netch/Utils/Utils.cs
index 2c0b037c..c4609d04 100644
--- a/Netch/Utils/Utils.cs
+++ b/Netch/Utils/Utils.cs
@@ -94,6 +94,9 @@ public static class Utils
public static async Task Sha256CheckSumAsync(string filePath)
{
+ if (!File.Exists(filePath))
+ return "";
+
try
{
await using var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, true);