mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 23:13:01 +00:00
Fix SplitHTTP H3 crash on v2rayNG (#3559)
Fixes https://github.com/XTLS/Xray-core/issues/3556
This commit is contained in:
parent
b277bacdf6
commit
d8994b7603
@ -101,11 +101,32 @@ func getHTTPClient(ctx context.Context, dest net.Destination, streamSettings *in
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
udpAddr, err := net.ResolveUDPAddr("udp", conn.RemoteAddr().String())
|
|
||||||
if err != nil {
|
var udpConn *net.UDPConn
|
||||||
return nil, err
|
var udpAddr *net.UDPAddr
|
||||||
|
|
||||||
|
switch c := conn.(type) {
|
||||||
|
case *internet.PacketConnWrapper:
|
||||||
|
var ok bool
|
||||||
|
udpConn, ok = c.Conn.(*net.UDPConn)
|
||||||
|
if !ok {
|
||||||
|
return nil, errors.New("PacketConnWrapper does not contain a UDP connection")
|
||||||
|
}
|
||||||
|
udpAddr, err = net.ResolveUDPAddr("udp", c.Dest.String())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
case *net.UDPConn:
|
||||||
|
udpConn = c
|
||||||
|
udpAddr, err = net.ResolveUDPAddr("udp", c.RemoteAddr().String())
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return nil, errors.New("unsupported connection type: %T", conn)
|
||||||
}
|
}
|
||||||
return quic.DialEarly(ctx, conn.(*internet.PacketConnWrapper).Conn.(*net.UDPConn), udpAddr, tlsCfg, cfg)
|
|
||||||
|
return quic.DialEarly(ctx, udpConn, udpAddr, tlsCfg, cfg)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
downloadTransport = roundTripper
|
downloadTransport = roundTripper
|
||||||
|
Loading…
Reference in New Issue
Block a user