mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-12-01 14:18:36 +00:00
Fix IPv6 literal host handling
This commit is contained in:
@@ -34,6 +34,7 @@ import (
|
||||
"github.com/sagernet/sing/common/debug"
|
||||
E "github.com/sagernet/sing/common/exceptions"
|
||||
"github.com/sagernet/sing/common/logger"
|
||||
M "github.com/sagernet/sing/common/metadata"
|
||||
"github.com/sagernet/sing/common/ntp"
|
||||
aTLS "github.com/sagernet/sing/common/tls"
|
||||
|
||||
@@ -254,7 +255,15 @@ func realityClientFallback(ctx context.Context, uConn net.Conn, serverName strin
|
||||
},
|
||||
},
|
||||
}
|
||||
request, _ := http.NewRequest("GET", "https://"+serverName, nil)
|
||||
serverAddress := M.ParseSocksaddrHostPort(serverName, 0)
|
||||
host := serverAddress.AddrString()
|
||||
if serverAddress.IsIPv6() {
|
||||
host = "[" + host + "]"
|
||||
}
|
||||
request, err := http.NewRequest("GET", "https://"+host, nil)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
request.Header.Set("User-Agent", fingerprint.Client)
|
||||
request.AddCookie(&http.Cookie{Name: "padding", Value: strings.Repeat("0", mRand.Intn(32)+30)})
|
||||
response, err := client.Do(request)
|
||||
|
||||
Reference in New Issue
Block a user