Commit Graph

128 Commits

Author SHA1 Message Date
Marten Seemann
eb656df2fe convert Stream interface to a struct (#5149) 2025-06-01 05:40:05 +02:00
Marten Seemann
c00a673d98 fix flaky TestConnectionPathValidation (#5175) 2025-05-31 06:02:30 +02:00
Ameame
8ef0a71581 store the RTT in the token, not in the session ticket (#5065)
* remove RTT from session ticket

* save RTT in token

* use mus as rtt unit in token

* move RTT from session state to token on client side

* Rename the rtt variables

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Update internal/handshake/token_generator.go

Co-authored-by: Marten Seemann <martenseemann@gmail.com>

* Update token_generator.go

* Update connection.go

* Update token_generator.go

* correct slice  access in fuzz.go

* rearrange connection constructor parameters

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-05-16 12:25:58 +02:00
Marten Seemann
2082d2c6b9 move connection tracking into the Transport (#5113) 2025-05-05 05:05:17 +02:00
Marten Seemann
9b3ff059fc delete closed connections after 3 PTOs (#5117)
In most cases, this should be earlier than the current
timeout value of 5s.
2025-05-04 12:51:39 +02:00
Marten Seemann
97e7657df5 delete retired connection IDs after 3 PTOs (#5109) 2025-05-03 14:24:40 +02:00
Marten Seemann
b3f55bb7b7 use assert.AnError consistently in tests (#5066)
No functional change expected.
2025-04-21 03:52:08 +02:00
Marten Seemann
848c355079 simplify path probe PING frame packing logic (#5028)
* simplify path probe PING frame packing logic

* also pack PTO probe packets for Initial and Handshake
2025-04-14 05:47:58 +02:00
Marten Seemann
a15ea40aa4 fix flaky TestConnectionPathValidation (#5030) 2025-04-12 05:19:08 +02:00
Marten Seemann
e76621f75a register stateless reset tokens for connection IDs used on paths (#5023)
* register stateless reset tokens for connection IDs used on paths

* retire path stateless reset tokens on closing
2025-04-09 04:31:41 +02:00
Marten Seemann
e4641d0325 fix flaky TestConnectionConnectionIDChanges (#4995) 2025-03-16 05:36:26 +01:00
Marten Seemann
6fe46d6253 send PATH_RESPONSEs on the same path (#4991)
* make it possible to pack path probes with multiple frames

* simplify function signature of pathManager.HandlePacket

* simplify connection short header packet handling logic

No functional change expected.

* make server send PATH_RESPONSEs on the same path

This makes sure that we’re actually testing for return routability.
2025-03-16 04:28:53 +01:00
Marten Seemann
24acc54ef1 add support for connection migration (#4960) 2025-03-12 06:11:11 +01:00
Marten Seemann
5a1a34df37 implement server-side path validation logic (#4944) 2025-02-12 13:50:11 +01:00
Marten Seemann
73108c2a51 fix connection busy-looping when pacing with a blocked send queue (#4943) 2025-01-28 15:10:18 +01:00
Marten Seemann
108b6603c8 ackhandler: implement timer logic for path probe packets (#4940)
* remove unused bool return value from sentPacketHandler.getPTOTimeAndSpace

* ackhandler: implement timer logic for path probing packets

Path probe packets are treated differently from regular packets: The new
path might have a vastly different RTT than the original path.

Path probe packets are declared lost 1s after they are sent. This value
can be reduced, once implement proper retransmission logic for lost path
probes.

* ackhandler: declare path probes lost on OnLossDetectionTimeout
2025-01-28 06:10:44 +01:00
Marten Seemann
6b9921bbfc refactor connection timer logic (#4927) 2025-01-28 05:08:05 +01:00
Marten Seemann
6f4c002513 fix flaky TestConnectionReceivePrioritization (#4936) 2025-01-27 04:40:46 +01:00
Marten Seemann
b098a75cf3 add a packet packer method to pack path probe packets (#4932) 2025-01-26 14:28:16 +01:00
Marten Seemann
ac25c646ad refactor packet handling into a separate function (#4926) 2025-01-26 06:17:40 +01:00
Marten Seemann
19213b24bc refactor connection error propagation (#4925) 2025-01-26 06:01:29 +01:00
Marten Seemann
383b634df6 simplify handling of packet unpacking errors (#4924) 2025-01-26 05:43:26 +01:00
Marten Seemann
62947d97f5 simplify generation of stateless reset tokens (#4858) 2025-01-11 17:52:59 +08:00
Marten Seemann
3cb5f3e104 optimize packing of STREAM_DATA_BLOCKED frames (#4801)
* refactor the framer to pack both control and STREAM frames

* refactor framer STREAM frame packing logic

* pack STREAM_DATA_BLOCKED in the same packet as the STREAM frame

This makes debugging easier (and is slightly more efficient). In the
pathological case where there is not enough space remaning in the packet
to pack the STREAM_DATA_BLOCKED frame, it is queued for the next packet.

* add an integration test
2025-01-07 12:06:00 +08:00
Marten Seemann
4ab8ec49d1 fix flaky TestConnectionCongestionControl (#4839) 2025-01-06 17:05:43 +08:00
Marten Seemann
febf2809e0 fix GSO sending logic to respect ECN marking changes (#4835) 2025-01-06 15:47:00 +08:00
Marten Seemann
421332c716 validate the stream ID of STREAM_DATA_BLOCKED frames (#4836) 2025-01-06 15:38:36 +08:00
Marten Seemann
f41a6a644d migrate the connection tests away from Ginkgo (#4823) 2025-01-06 14:48:11 +08:00
Marco Munizaga
ea6d198c3d drain received packets when the connection is closed (#4773)
* clear receivedPackets buffer on connection close

If packets were queued up in our receivedPackets queue when we closed
the connection we would fail reuse them. Eventually the GC would have to
clean this as trash.

* move drain logic to defer in run
2024-12-31 14:38:57 +08:00
Marten Seemann
a32d31288e remove hardcoded maximum keep-alive period (#4827)
The keep-alive period can be set using Config.KeepAlivePeriod. While
very large values will likely make keep-alives ineffective (depending on
the NATs in the path), there's no good reason to hardcode a maximum
value.
2024-12-31 11:26:40 +08:00
Marten Seemann
7d54aa41a3 remove unneeded Connection.GetVersion method (#4792)
Instead, use Connection.ConnectionState().Version.
2024-12-23 20:29:26 +08:00
Marten Seemann
363533dc7a remove the Token field from the StatelessResetError (#4740)
There's nothing the application could possibly do with this value.
2024-12-02 13:57:46 +08:00
Marten Seemann
40a768e77b flowcontrol: avoid calling time.Now(), pass time as a function parameter (#4731) 2024-11-28 17:46:22 +08:00
Marten Seemann
3e0a67b247 ci: update golangci-lint to v1.62.0 (#4725) 2024-11-18 16:01:39 +01:00
Marten Seemann
0b033db188 fix logging of short header connection IDs (#4626) 2024-08-06 17:28:40 -07:00
Marten Seemann
af9fa7a555 queue stream-related control frames in the respective stream (#4610)
* use a separate method for queueing control frames from the streams map

* queue stream-related control frames in the respective stream
2024-08-04 15:42:56 -07:00
Marten Seemann
f96923b5b2 logging: rename VersionNumber to Version (#4621) 2024-08-03 19:32:11 -07:00
Marten Seemann
9b70412b0f remove mock TokenStore implementation (#4597)
No functional change expected.
2024-07-24 16:28:01 -07:00
Marten Seemann
5f8d146836 wire: optimize parsing of long header packets (#4589) 2024-07-21 14:22:32 -07:00
Marten Seemann
44e0147f2e pass a context to Transport.ConnContext (#4536)
* pass a context to Transport.ConnContext

This context is cancelled when the QUIC connection is closed, or when
the QUIC handshake fails. This allows the application to easily build
and garbage collect a map of active connections.

* correctly handle fresh contexts returned from ConnContext
2024-06-04 21:37:18 -07:00
Marten Seemann
0d1e27d77c introduce Transport.ConnContext, use client's context on the connection (#4507)
* introduce Transport.ConnContext, use client's context on the connection

* panic if ConnContext returns nil
2024-05-26 21:30:19 -07:00
Marten Seemann
2557fb98b2 initialize the MTU discoverer when processing the transport parameters (#4514)
On the client side, we always use the configured packet size. This comes
with the risk of failing the handshake if the path doesn't support this
MTU. If the server sends a max_udp_payload_size that's smaller than this
size, we can safely ignore this: Obviously, the server still processed
the (fully padded) Initial packet, despite claiming that it wouldn't do
so.

On the server side, there's no downside to using 1200 bytes until we
received the client's transport parameters:
* If the first packet didn't contain the entire ClientHello, all we can
do is ACK that packet. We don't need a lot of bytes for that.
* If it did, we will have processed the transport parameters and
initialized the MTU discoverer.
2024-05-13 22:50:26 -07:00
Marten Seemann
4f4da0423f ci: disable exhaustive linter for test files (#4499) 2024-05-06 21:36:22 -07:00
Marten Seemann
b7a02137f9 fix capture of loop variable in connection probe packet tests (#4486) 2024-05-04 15:49:10 -07:00
Marten Seemann
c0250ce824 include the maximum payload size in the DatagramTooLargeError (#4470)
This is more useful than the maximum frame size. The user of the library
shouldn't have to care about the QUIC framing layer.

---------

Co-authored-by: 世界 <i@sekai.icu>
2024-04-27 05:54:16 -07:00
Marten Seemann
b0eb608180 testutils: add a token parameter to ComposeInitialPacket (#4391) 2024-04-23 13:43:28 -07:00
Marten Seemann
f1476390f2 update gomock to v0.4.0 (#4361) 2024-03-10 18:07:20 -07:00
Marten Seemann
c786a46f42 remove unused perspective arg from packetHandlerMap.ReplaceWithClosed (#4330) 2024-02-10 19:27:51 -08:00
Marten Seemann
fbaa941ea1 protocol: rename VersionNumber to Version (#4295) 2024-01-31 21:57:33 -08:00
Marten Seemann
da25787a3d testutils: make the package public (#4290)
This package can be useful outside of quic-go. We're not making any API
guarantees at this point.
2024-01-30 19:00:08 -08:00