mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 17:44:02 +03:00
Modified antireplay
This commit is contained in:
+4
-2
@@ -45,10 +45,12 @@ func DirectInit(ctx context.Context, cancel context.CancelFunc, socket net.Conn,
|
||||
return nil, nil, errors.Annotate(err, "Cannot parse obfuscated frame")
|
||||
}
|
||||
|
||||
if antiReplayCache.Has([]byte(frame)) {
|
||||
var replayPart = []byte(frame)
|
||||
|
||||
if antiReplayCache.Has(replayPart[4:60]) {
|
||||
return nil, nil, errors.New("Replay attack is detected")
|
||||
}
|
||||
antiReplayCache.Add([]byte(frame))
|
||||
antiReplayCache.Add(replayPart[4:60])
|
||||
|
||||
connOpts.ConnectionProto = mtproto.ConnectionProtocolAny
|
||||
connOpts.ClientAddr = conn.RemoteAddr()
|
||||
|
||||
Reference in New Issue
Block a user