mirror of
https://github.com/refraction-networking/uquic.git
synced 2025-04-05 13:17:36 +03:00
remove unneeded testutils.ComposeAckFrame helper function
This commit is contained in:
parent
81d16a9903
commit
7d6be20fdc
3 changed files with 4 additions and 16 deletions
|
@ -328,8 +328,8 @@ var _ = Describe("MITM test", func() {
|
||||||
// expects hdr from an Initial packet intercepted from client
|
// expects hdr from an Initial packet intercepted from client
|
||||||
sendForgedInitialPacketWithAck := func(conn net.PacketConn, remoteAddr net.Addr, hdr *wire.Header) {
|
sendForgedInitialPacketWithAck := func(conn net.PacketConn, remoteAddr net.Addr, hdr *wire.Header) {
|
||||||
// Fake Initial with ACK for packet 2 (unsent)
|
// Fake Initial with ACK for packet 2 (unsent)
|
||||||
ackFrame := testutils.ComposeAckFrame(2, 2)
|
ack := &wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 2, Largest: 2}}}
|
||||||
initialPacket := testutils.ComposeInitialPacket(hdr.DestConnectionID, hdr.SrcConnectionID, hdr.Version, hdr.DestConnectionID, []wire.Frame{ackFrame})
|
initialPacket := testutils.ComposeInitialPacket(hdr.DestConnectionID, hdr.SrcConnectionID, hdr.Version, hdr.DestConnectionID, []wire.Frame{ack})
|
||||||
_, err := conn.WriteTo(initialPacket, remoteAddr)
|
_, err := conn.WriteTo(initialPacket, remoteAddr)
|
||||||
Expect(err).ToNot(HaveOccurred())
|
Expect(err).ToNot(HaveOccurred())
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,18 +50,6 @@ func ComposeConnCloseFrame() *wire.ConnectionCloseFrame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ComposeAckFrame returns a new Ack Frame that acknowledges all packets between smallest and largest
|
|
||||||
func ComposeAckFrame(smallest protocol.PacketNumber, largest protocol.PacketNumber) *wire.AckFrame {
|
|
||||||
ackRange := wire.AckRange{
|
|
||||||
Smallest: smallest,
|
|
||||||
Largest: largest,
|
|
||||||
}
|
|
||||||
return &wire.AckFrame{
|
|
||||||
AckRanges: []wire.AckRange{ackRange},
|
|
||||||
DelayTime: 0,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ComposeInitialPacket returns an Initial packet encrypted under key
|
// ComposeInitialPacket returns an Initial packet encrypted under key
|
||||||
// (the original destination connection ID) containing specified frames
|
// (the original destination connection ID) containing specified frames
|
||||||
func ComposeInitialPacket(srcConnID protocol.ConnectionID, destConnID protocol.ConnectionID, version protocol.VersionNumber, key protocol.ConnectionID, frames []wire.Frame) []byte {
|
func ComposeInitialPacket(srcConnID protocol.ConnectionID, destConnID protocol.ConnectionID, version protocol.VersionNumber, key protocol.ConnectionID, frames []wire.Frame) []byte {
|
||||||
|
|
|
@ -2956,8 +2956,8 @@ var _ = Describe("Client Session", func() {
|
||||||
// Illustrates that an injected Initial with an ACK frame for an unsent packet causes
|
// Illustrates that an injected Initial with an ACK frame for an unsent packet causes
|
||||||
// the connection to immediately break down
|
// the connection to immediately break down
|
||||||
It("fails on Initial-level ACK for unsent packet", func() {
|
It("fails on Initial-level ACK for unsent packet", func() {
|
||||||
ackFrame := testutils.ComposeAckFrame(0, 0)
|
ack := &wire.AckFrame{AckRanges: []wire.AckRange{{Smallest: 2, Largest: 2}}}
|
||||||
initialPacket := testutils.ComposeInitialPacket(destConnID, srcConnID, sess.version, destConnID, []wire.Frame{ackFrame})
|
initialPacket := testutils.ComposeInitialPacket(destConnID, srcConnID, sess.version, destConnID, []wire.Frame{ack})
|
||||||
tracer.EXPECT().ReceivedPacket(gomock.Any(), gomock.Any(), gomock.Any())
|
tracer.EXPECT().ReceivedPacket(gomock.Any(), gomock.Any(), gomock.Any())
|
||||||
Expect(sess.handlePacketImpl(wrapPacket(initialPacket))).To(BeFalse())
|
Expect(sess.handlePacketImpl(wrapPacket(initialPacket))).To(BeFalse())
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue