Browser Dialer: Potential optimized IP and non-standard port

Fixes https://github.com/2dust/v2rayNG/issues/5519#issuecomment-4335112057
This commit is contained in:
RPRX
2026-04-28 20:57:20 +00:00
committed by GitHub
parent b4f08981be
commit 1836b1c6e4
2 changed files with 31 additions and 6 deletions
+12
View File
@@ -373,6 +373,12 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
if requestURL.Host == "" {
requestURL.Host = dest.Address.String()
}
if browser_dialer.HasBrowserDialer() && realityConfig == nil {
// For Browser Dialer's optimized IP and non-standard port
if !(requestURL.Scheme == "http" && dest.Port == 80) && !(requestURL.Scheme == "https" && dest.Port == 443) {
requestURL.Host += ":" + dest.Port.String()
}
}
requestURL.Path = transportConfiguration.GetNormalizedPath()
requestURL.RawQuery = transportConfiguration.GetNormalizedQuery()
@@ -434,6 +440,12 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me
if requestURL2.Host == "" {
requestURL2.Host = dest2.Address.String()
}
if browser_dialer.HasBrowserDialer() && realityConfig2 == nil {
// For Browser Dialer's optimized IP and non-standard port
if !(requestURL2.Scheme == "http" && dest2.Port == 80) && !(requestURL2.Scheme == "https" && dest2.Port == 443) {
requestURL2.Host += ":" + dest2.Port.String()
}
}
requestURL2.Path = config2.GetNormalizedPath()
requestURL2.RawQuery = config2.GetNormalizedQuery()
httpClient2, xmuxClient2 = getHTTPClient(ctx, dest2, memory2)