mirror of
https://github.com/MetaCubeX/mihomo.git
synced 2026-12-02 09:16:47 +00:00
fix: ipv6 url parse in xhttp (#3160)
This commit is contained in:
1 parent
65287f0e0f
commit
68ec4fae65
1 file changed
+7
@@ -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
|
||||
|
||||
Reference in new issue
Block a user