Skip to content

Commit

Permalink
improve encryption check errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lhridder committed Aug 3, 2022
1 parent 33dd644 commit d683d2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -729,14 +729,14 @@ func (gateway *Gateway) loginCheck(conn Conn, session *Session) error {
if err != nil {
handshakeCount.With(prometheus.Labels{"type": "cancelled_encryption", "host": session.serverAddress, "country": session.country}).Inc()
err = gateway.rdb.Set(ctx, "ip:"+session.ip, "false,"+session.country, time.Hour*12).Err()
return errors.New("invalid encryption response")
return errors.New("cannot read encryption response")
}

encryptionRes, encryptionResNew, err := login.UnmarshalServerBoundEncryptionResponse(encryptionResponse, session.ProtocolVersion)
if err != nil {
handshakeCount.With(prometheus.Labels{"type": "cancelled_encryption", "host": session.serverAddress, "country": session.country}).Inc()
err = gateway.rdb.Set(ctx, "ip:"+session.ip, "false,"+session.country, time.Hour*12).Err()
return errors.New("invalid encryptionResponse")
return errors.New("cannot parse encryption response")
}

var decryptedSharedSecret []byte
Expand Down

0 comments on commit d683d2d

Please sign in to comment.