mirror of
https://github.com/shtorm-7/sing-box-extended.git
synced 2026-10-28 14:07:00 +00:00
vless: fix nil pointer panic on encryption handshake failure
This commit is contained in:
@@ -214,10 +214,13 @@ func (h *vlessDialer) DialContext(ctx context.Context, network string, destinati
|
||||
}
|
||||
|
||||
if h.encryption != nil {
|
||||
conn, err = h.encryption.Handshake(conn)
|
||||
var encConn net.Conn
|
||||
encConn, err = h.encryption.Handshake(conn)
|
||||
if err != nil {
|
||||
common.Close(conn)
|
||||
return nil, E.Cause(err, "encryption handshake")
|
||||
}
|
||||
conn = encConn
|
||||
}
|
||||
|
||||
var visionBaseConn net.Conn
|
||||
@@ -299,11 +302,13 @@ func (h *vlessDialer) ListenPacket(ctx context.Context, destination M.Socksaddr)
|
||||
return nil, err
|
||||
}
|
||||
if h.encryption != nil {
|
||||
conn, err = h.encryption.Handshake(conn)
|
||||
var encConn net.Conn
|
||||
encConn, err = h.encryption.Handshake(conn)
|
||||
if err != nil {
|
||||
common.Close(conn)
|
||||
return nil, E.Cause(err, "encryption handshake")
|
||||
}
|
||||
conn = encConn
|
||||
}
|
||||
if h.xudp {
|
||||
return h.client.DialEarlyXUDPPacketConn(conn, destination)
|
||||
|
||||
Reference in New Issue
Block a user