|
|
@@ -45,10 +45,12 @@ func DirectInit(ctx context.Context, cancel context.CancelFunc, socket net.Conn,
|
|
45
|
45
|
return nil, nil, errors.Annotate(err, "Cannot parse obfuscated frame")
|
|
46
|
46
|
}
|
|
47
|
47
|
|
|
48
|
|
- if antiReplayCache.Has([]byte(frame)) {
|
|
|
48
|
+ var replayPart = []byte(frame)
|
|
|
49
|
+
|
|
|
50
|
+ if antiReplayCache.Has(replayPart[4:60]) {
|
|
49
|
51
|
return nil, nil, errors.New("Replay attack is detected")
|
|
50
|
52
|
}
|
|
51
|
|
- antiReplayCache.Add([]byte(frame))
|
|
|
53
|
+ antiReplayCache.Add(replayPart[4:60])
|
|
52
|
54
|
|
|
53
|
55
|
connOpts.ConnectionProto = mtproto.ConnectionProtocolAny
|
|
54
|
56
|
connOpts.ClientAddr = conn.RemoteAddr()
|