mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-26 17:03:02 +00:00
Fix VLESS & Trojan fallbacks xver
This commit is contained in:
parent
7da97635b2
commit
8ffc430351
@ -500,19 +500,16 @@ func (s *Server) fallback(ctx context.Context, sid errors.ExportOption, err erro
|
|||||||
postRequest := func() error {
|
postRequest := func() error {
|
||||||
defer timer.SetTimeout(sessionPolicy.Timeouts.DownlinkOnly)
|
defer timer.SetTimeout(sessionPolicy.Timeouts.DownlinkOnly)
|
||||||
if fb.Xver != 0 {
|
if fb.Xver != 0 {
|
||||||
var remoteAddr, remotePort, localAddr, localPort string
|
ipType := 4
|
||||||
ipType, network := 0, connection.RemoteAddr().Network()
|
remoteAddr, remotePort, err := net.SplitHostPort(connection.RemoteAddr().String())
|
||||||
if len(network) >= 3 && network[:3] == "tcp" {
|
|
||||||
var err error
|
|
||||||
remoteAddr, remotePort, err = net.SplitHostPort(connection.RemoteAddr().String())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
ipType = 0
|
||||||
}
|
}
|
||||||
localAddr, localPort, err = net.SplitHostPort(connection.LocalAddr().String())
|
localAddr, localPort, err := net.SplitHostPort(connection.LocalAddr().String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
ipType = 0
|
||||||
}
|
}
|
||||||
ipType = 4
|
if ipType == 4 {
|
||||||
for i := 0; i < len(remoteAddr); i++ {
|
for i := 0; i < len(remoteAddr); i++ {
|
||||||
if remoteAddr[i] == ':' {
|
if remoteAddr[i] == ':' {
|
||||||
ipType = 6
|
ipType = 6
|
||||||
|
@ -335,19 +335,16 @@ func (h *Handler) Process(ctx context.Context, network net.Network, connection i
|
|||||||
postRequest := func() error {
|
postRequest := func() error {
|
||||||
defer timer.SetTimeout(sessionPolicy.Timeouts.DownlinkOnly)
|
defer timer.SetTimeout(sessionPolicy.Timeouts.DownlinkOnly)
|
||||||
if fb.Xver != 0 {
|
if fb.Xver != 0 {
|
||||||
var remoteAddr, remotePort, localAddr, localPort string
|
ipType := 4
|
||||||
ipType, network := 0, connection.RemoteAddr().Network()
|
remoteAddr, remotePort, err := net.SplitHostPort(connection.RemoteAddr().String())
|
||||||
if len(network) >= 3 && network[:3] == "tcp" {
|
|
||||||
var err error
|
|
||||||
remoteAddr, remotePort, err = net.SplitHostPort(connection.RemoteAddr().String())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
ipType = 0
|
||||||
}
|
}
|
||||||
localAddr, localPort, err = net.SplitHostPort(connection.LocalAddr().String())
|
localAddr, localPort, err := net.SplitHostPort(connection.LocalAddr().String())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
ipType = 0
|
||||||
}
|
}
|
||||||
ipType = 4
|
if ipType == 4 {
|
||||||
for i := 0; i < len(remoteAddr); i++ {
|
for i := 0; i < len(remoteAddr); i++ {
|
||||||
if remoteAddr[i] == ':' {
|
if remoteAddr[i] == ':' {
|
||||||
ipType = 6
|
ipType = 6
|
||||||
|
Loading…
Reference in New Issue
Block a user