mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-23 16:54:40 +00:00
Fix dns (#8174)
This commit is contained in:
parent
e4701d6703
commit
ecf42cb85d
2 changed files with 11 additions and 1 deletions
|
@ -215,6 +215,7 @@ public class Dns4Ray
|
|||
public class DnsServer4Ray
|
||||
{
|
||||
public string? address { get; set; }
|
||||
public int? port { get; set; }
|
||||
public List<string>? domains { get; set; }
|
||||
public bool? skipFallback { 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)
|
||||
{
|
||||
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
|
||||
{
|
||||
address = dnsAddress,
|
||||
address = domainFinal,
|
||||
port = portFinal,
|
||||
skipFallback = true,
|
||||
domains = domains.Count > 0 ? domains : null,
|
||||
expectedIPs = expectedIPs?.Count > 0 ? expectedIPs : null
|
||||
|
|
Loading…
Reference in a new issue