Disable anti-amplification limit by address validation token (#3326)

This commit is contained in:
Benedikt Spies 2022-08-20 17:02:17 +02:00 committed by GitHub
parent 8c0c481da1
commit 7da024da5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 75 additions and 12 deletions

View file

@ -29,7 +29,7 @@ var _ = Describe("SentPacketHandler", func() {
JustBeforeEach(func() {
lostPackets = nil
rttStats := utils.NewRTTStats()
handler = newSentPacketHandler(42, protocol.InitialPacketSizeIPv4, rttStats, perspective, nil, utils.DefaultLogger)
handler = newSentPacketHandler(42, protocol.InitialPacketSizeIPv4, rttStats, false, perspective, nil, utils.DefaultLogger)
streamFrame = wire.StreamFrame{
StreamID: 5,
Data: []byte{0x13, 0x37},
@ -944,6 +944,26 @@ var _ = Describe("SentPacketHandler", func() {
})
})
Context("amplification limit, for the server, with validated address", func() {
JustBeforeEach(func() {
rttStats := utils.NewRTTStats()
handler = newSentPacketHandler(42, protocol.InitialPacketSizeIPv4, rttStats, true, perspective, nil, utils.DefaultLogger)
})
It("do not limits the window", func() {
handler.ReceivedBytes(0)
Expect(handler.SendMode()).To(Equal(SendAny))
handler.SentPacket(&Packet{
PacketNumber: 1,
Length: 900,
EncryptionLevel: protocol.EncryptionInitial,
Frames: []Frame{{Frame: &wire.PingFrame{}}},
SendTime: time.Now(),
})
Expect(handler.SendMode()).To(Equal(SendAny))
})
})
Context("amplification limit, for the client", func() {
BeforeEach(func() {
perspective = protocol.PerspectiveClient