fix: ipv6 url parse in xhttp (#3160)

This commit is contained in:
CyberVacation authored and GitHub committed 2026-08-31 15:26:17 +08:00
1 parent 65287f0e0f
commit 68ec4fae65
1 file changed
+7
+7
View File
@@ -5,6 +5,7 @@ import (
"errors"
"fmt"
"net"
"net/netip"
"strconv"
"strings"
"time"
@@ -618,6 +619,9 @@ func NewVless(option VlessOption) (*Vless, error) {
} else {
requestHost = v.option.Server
}
if ip, err := netip.ParseAddr(requestHost); err == nil && ip.Is6() {
requestHost = "[" + requestHost + "]"
}
}
var hKeepAlivePeriod time.Duration
@@ -797,6 +801,9 @@ func NewVless(option VlessOption) (*Vless, error) {
} else {
downloadHost = downloadServer
}
if ip, err := netip.ParseAddr(downloadHost); err == nil && ip.Is6() {
downloadHost = "[" + downloadHost + "]"
}
}
downloadHKeepAlivePeriod := hKeepAlivePeriod