mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-21 09:36:34 -05:00
test case for anti reply attack
This commit is contained in:
parent
3e10f3ae69
commit
10d26f2d7f
@ -41,6 +41,9 @@ func TestRequestSerialization(t *testing.T) {
|
||||
client := NewClientSession(protocol.DefaultIDHash)
|
||||
client.EncodeRequestHeader(expectedRequest, buffer)
|
||||
|
||||
buffer2 := buf.New()
|
||||
buffer2.Append(buffer.Bytes())
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
userValidator := vmess.NewTimedUserValidator(ctx, protocol.DefaultIDHash)
|
||||
userValidator.Add(user)
|
||||
@ -55,5 +58,10 @@ func TestRequestSerialization(t *testing.T) {
|
||||
assert.Address(expectedRequest.Address).Equals(actualRequest.Address)
|
||||
assert.Port(expectedRequest.Port).Equals(actualRequest.Port)
|
||||
assert.Byte(byte(expectedRequest.Security)).Equals(byte(actualRequest.Security))
|
||||
|
||||
_, err = server.DecodeRequestHeader(buffer2)
|
||||
// anti reply attack
|
||||
assert.Error(err).IsNotNil()
|
||||
|
||||
cancel()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user