mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 21:34:02 +03:00
+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")
|
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")
|
return nil, nil, errors.New("Replay attack is detected")
|
||||||
}
|
}
|
||||||
antiReplayCache.Add([]byte(frame))
|
antiReplayCache.Add(replayPart[4:60])
|
||||||
|
|
||||||
connOpts.ConnectionProto = mtproto.ConnectionProtocolAny
|
connOpts.ConnectionProto = mtproto.ConnectionProtocolAny
|
||||||
connOpts.ClientAddr = conn.RemoteAddr()
|
connOpts.ClientAddr = conn.RemoteAddr()
|
||||||
|
|||||||
Reference in New Issue
Block a user