Fix dns (#8174)
This commit is contained in:
@@ -215,6 +215,7 @@ public class Dns4Ray
|
|||||||
public class DnsServer4Ray
|
public class DnsServer4Ray
|
||||||
{
|
{
|
||||||
public string? address { get; set; }
|
public string? address { get; set; }
|
||||||
|
public int? port { get; set; }
|
||||||
public List<string>? domains { get; set; }
|
public List<string>? domains { get; set; }
|
||||||
public bool? skipFallback { get; set; }
|
public bool? skipFallback { get; set; }
|
||||||
public List<string>? expectedIPs { get; set; }
|
public List<string>? expectedIPs { get; set; }
|
||||||
|
|||||||
@@ -79,9 +79,18 @@ public partial class CoreConfigV2rayService
|
|||||||
|
|
||||||
static object CreateDnsServer(string dnsAddress, List<string> domains, List<string>? expectedIPs = null)
|
static object CreateDnsServer(string dnsAddress, List<string> domains, List<string>? expectedIPs = null)
|
||||||
{
|
{
|
||||||
|
var (domain, scheme, port, path) = Utils.ParseUrl(dnsAddress);
|
||||||
|
var domainFinal = dnsAddress;
|
||||||
|
int? portFinal = null;
|
||||||
|
if (scheme.IsNullOrEmpty() || scheme.Contains("udp", StringComparison.OrdinalIgnoreCase) || scheme.Contains("tcp", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
domainFinal = domain;
|
||||||
|
portFinal = port > 0 ? port : null;
|
||||||
|
}
|
||||||
var dnsServer = new DnsServer4Ray
|
var dnsServer = new DnsServer4Ray
|
||||||
{
|
{
|
||||||
address = dnsAddress,
|
address = domainFinal,
|
||||||
|
port = portFinal,
|
||||||
skipFallback = true,
|
skipFallback = true,
|
||||||
domains = domains.Count > 0 ? domains : null,
|
domains = domains.Count > 0 ? domains : null,
|
||||||
expectedIPs = expectedIPs?.Count > 0 ? expectedIPs : null
|
expectedIPs = expectedIPs?.Count > 0 ? expectedIPs : null
|
||||||
|
|||||||
Reference in New Issue
Block a user