mirror of
https://github.com/netchx/netch.git
synced 2026-03-14 17:43:18 +08:00
@@ -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());
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
/// <summary>
|
||||
/// 缓存
|
||||
/// </summary>
|
||||
@@ -14,6 +17,7 @@ public static class DnsUtils
|
||||
|
||||
public static async Task<IPAddress?> LookupAsync(string hostname, AddressFamily inet = AddressFamily.Unspecified, int timeout = 3000)
|
||||
{
|
||||
using var _ = await Lock.EnterAsync();
|
||||
try
|
||||
{
|
||||
var cacheResult = inet switch
|
||||
|
||||
@@ -94,6 +94,9 @@ public static class Utils
|
||||
|
||||
public static async Task<string> Sha256CheckSumAsync(string filePath)
|
||||
{
|
||||
if (!File.Exists(filePath))
|
||||
return "";
|
||||
|
||||
try
|
||||
{
|
||||
await using var fileStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read, 4096, true);
|
||||
|
||||
Reference in New Issue
Block a user