From f28fa31c145c56f1024881797343b439533ad013 Mon Sep 17 00:00:00 2001 From: DHR60 Date: Thu, 23 Oct 2025 17:57:47 +0800 Subject: [PATCH] Fix tcp dns (#8179) --- .../Services/CoreConfig/V2ray/V2rayDnsService.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs index d3cff6cc..7170c5f0 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/V2ray/V2rayDnsService.cs @@ -82,11 +82,16 @@ public partial class CoreConfigV2rayService 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)) + if (scheme.IsNullOrEmpty() || scheme.StartsWith("udp", StringComparison.OrdinalIgnoreCase)) { domainFinal = domain; portFinal = port > 0 ? port : null; } + else if (scheme.StartsWith("tcp", StringComparison.OrdinalIgnoreCase)) + { + domainFinal = scheme + "://" + domain; + portFinal = port > 0 ? port : null; + } var dnsServer = new DnsServer4Ray { address = domainFinal,