[Netch] WTF

This commit is contained in:
Connection Refused
2021-10-19 02:41:49 +08:00
parent cf21c08600
commit cc69dff5e1
11 changed files with 117 additions and 73 deletions

View File

@@ -3,9 +3,33 @@
public class ProcessMode
{
/// <summary>
/// DNS
/// 伪造 ICMP 延迟
/// </summary>
[Newtonsoft.Json.JsonProperty("dns")]
public string DNS = "1.1.1.1:53";
[Newtonsoft.Json.JsonProperty("icmping")]
public int Icmping = 1;
/// <summary>
/// 仅劫持规则内进程
/// </summary>
[Newtonsoft.Json.JsonProperty("dnsOnly")]
public bool DNSOnly = false;
/// <summary>
/// 远程 DNS 查询
/// </summary>
[Newtonsoft.Json.JsonProperty("dnsProx")]
public bool DNSProx = true;
/// <summary>
/// DNS 地址
/// </summary>
[Newtonsoft.Json.JsonProperty("dnsHost")]
public string DNSHost = "1.1.1.1";
/// <summary>
/// DNS 端口
/// </summary>
[Newtonsoft.Json.JsonProperty("dnsPort")]
public ushort DNSPort = 53;
}
}

View File

@@ -39,6 +39,12 @@ namespace Netch.Models.Mode.ProcessMode
[Newtonsoft.Json.JsonProperty("filterUDP")]
public bool UDP = true;
/// <summary>
/// 过滤 DNS 流量
/// </summary>
[Newtonsoft.Json.JsonProperty("filterDNS")]
public bool DNS = true;
/// <summary>
/// 绕过列表
/// </summary>

View File

@@ -45,7 +45,16 @@ namespace Netch.Models.Server
/// 解析地址
/// </summary>
/// <returns></returns>
public string Resolve() => (Utils.DNS.Fetch(this.Host) != IPAddress.Any) ? Utils.DNS.Fetch(this.Host).ToString() : this.Host;
public string Resolve()
{
var addr = Utils.DNS.Fetch(this.Host);
while (addr == IPAddress.Any)
{
addr = Utils.DNS.Fetch(this.Host);
}
return addr.ToString();
}
/// <summary>
/// 获取备注