fix ecdh crash in reality

This commit is contained in:
hossinasaadi 2023-12-23 11:38:43 +04:00 committed by yuhan6665
parent 01c14a5994
commit b7f21be8bc
1 changed files with 4 additions and 1 deletions

View File

@ -136,7 +136,10 @@ func UClient(c net.Conn, config *Config, ctx context.Context, dest net.Destinati
if config.Show {
newError(fmt.Sprintf("REALITY localAddr: %v\thello.SessionId[:16]: %v\n", localAddr, hello.SessionId[:16])).WriteToLog(session.ExportIDToError(ctx))
}
publicKey, _ := ecdh.X25519().NewPublicKey(config.PublicKey)
publicKey, err := ecdh.X25519().NewPublicKey(config.PublicKey)
if err != nil {
return nil, errors.New("REALITY: publicKey == nil")
}
uConn.AuthKey, _ = uConn.HandshakeState.State13.EcdheKey.ECDH(publicKey)
if uConn.AuthKey == nil {
return nil, errors.New("REALITY: SharedKey == nil")