Rework antireplay

This commit is contained in:
9seconds
2019-10-07 17:51:21 +03:00
parent 413cafeeb6
commit d44474012a
3 changed files with 42 additions and 26 deletions
+2 -2
View File
@@ -80,10 +80,10 @@ func (c *ClientProtocol) Handshake(socket conntypes.StreamReadWriteCloser) (conn
}
antiReplayKey := decryptedFrame.Unique()
if antireplay.Has(antiReplayKey) {
if antireplay.Cache.Has(antiReplayKey) {
return nil, errors.New("Replay attack is detected")
}
antireplay.Add(antiReplayKey)
antireplay.Cache.Add(antiReplayKey)
return wrappers.NewObfuscated2(socket, encryptor, decryptor), nil
}