Commit Graph

697 Commits

Author SHA1 Message Date
Marten Seemann
5c3af443c1 http3: simplify HTTP datagram handling (#5156) 2025-05-29 06:23:05 +02:00
Marten Seemann
2675d0845f http3: convert RequestStream from an interface to a struct (#5153) 2025-05-29 05:08:39 +02:00
Marten Seemann
04eab22893 http3: fix off-by-one error when processing the GOAWAY stream ID (#5145) 2025-05-20 08:43:33 +02:00
Marten Seemann
363e0ccafb http3: implement client-side GOAWAY handling (#5143)
When receiving a GOAWAY frame, the client:
* immediately closes the connection if there are no active requests
* refuses to open streams with stream IDs larger than the stream ID in
the GOAWAY frame
* closes the connection once the stream count drops to zero
2025-05-18 07:33:43 +02:00
sukun
eb8547ca73 pass ClientInfo to Transport.ConnContext, allow rejection of handshake (#5122)
* pass *ClientInfo to ConnContext

This allows users to set some state related to the client's remote
address in `ConnContext`.

This also refuses connection early if the returned context is cancelled.

* review comments

* better error assertion

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-05-16 12:03:05 +02:00
Marten Seemann
77c401dcbb http3: only retry requests for which it is safe to do so (#5141)
* add an integration test for HTTP/3 redialing logic

* http3: only retry requests for which it is safe to do so
2025-05-16 05:22:13 +02:00
Marten Seemann
d7ca54c602 fix flaky TestHandshakeCloseListener (#5140) 2025-05-11 06:54:28 +02:00
Marten Seemann
1725cb0878 http3: close QUIC listeners created by Server on graceful shutdown (#5101) 2025-05-08 08:22:11 +02:00
Marten Seemann
8296ba7d19 http3: don't close QUIC listeners created by the application (#5129) 2025-05-08 07:40:23 +02:00
Marten Seemann
f3f476a908 never close accepted connections when the listener is closed (#5108) 2025-05-06 05:18:44 +02:00
Marten Seemann
cfc6c16f36 fix race condition in tests when setting the key update interval (#5121)
* fix race conditions in tests when setting the key update interval

* remove test for running transports and handshakes
2025-05-06 04:45:27 +02:00
Marten Seemann
4c6aca6b43 remove stray assertion that handshakes are running from tests (#5123)
The RunHandshake method this function was basing its assertion on was
removed a long time ago.
2025-05-06 09:13:38 +07:00
Marten Seemann
44207b8e72 http3: reset request streams accepted after graceful shutdown (#5116)
* http3: reset request streams accepted after graceful shutdown

The server needs to let the client know that these streams
are not getting processed, using the H3_REQUEST_REJECTED
error code.

* add an integration test for graceful shutdown stream cancellations
2025-05-05 04:28:01 +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
b3f55bb7b7 use assert.AnError consistently in tests (#5066)
No functional change expected.
2025-04-21 03:52:08 +02:00
Marten Seemann
d35b5ac187 use ed25519 instead of RSA in tests and examples (#5050)
Also adds a golangci-lint depguard rules that forbids
importing crypto/rsa.
2025-04-20 05:55:08 +02:00
Marten Seemann
267cca773b switch from math/rand to math/rand/v2 (#5045)
* switch from math/rand to math/rand/v2

* switch away from golang.org/x/exp/rand
2025-04-19 09:01:22 +02:00
Peter Wu
23ec5b957c fix flaky TestDatagramLoss (#5017)
Fixes #4784
2025-04-12 10:59:14 +02:00
Marten Seemann
ef2b87f5d5 detect stateless resets for zero-length connection IDs (#5027) 2025-04-11 15:23:53 +02:00
Marten Seemann
79d546379b rename ClientHelloInfo to ClientInfo (#5016)
There’s no ClientHello (which is a TLS concept) involved here.
2025-03-31 16:15:09 +02:00
Marten Seemann
1d8f3f281a ci: update golangci-lint to v2 (#5007) 2025-03-30 07:16:14 +02:00
Peter Wu
384a4b8d50 proxy: fix test timeout failures during cleanup (#5010)
Several proxy tests timed out because it got stuck in the packet read
loop after all tests have run. Avoid this by running the `conn.Close()`
Cleanup call from `newUPDConnLocalhost` before the timeout handler.

Update CI to run these tests.

Fixes: 3e87ea3f50 ("proxy: add function to simulate NAT rebinding (#4922)")
Relates to: #5009
2025-03-29 13:04:44 +08: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
08a89e9f8b migrate the server tests away from Ginkgo (#4969) 2025-03-03 10:58:51 +01:00
Marten Seemann
751ca8dfb6 fix typo in UDP connection helper function in tests (#4970) 2025-02-24 09:39:29 +01:00
Marten Seemann
6033030017 proxy: add source and destination address to delay and drop callbacks (#4964) 2025-02-22 12:21:40 +01:00
Marten Seemann
12f2be058b bump go.mod version to Go 1.23, run 1.23 and 1.24 on CI (#4880) 2025-02-13 12:49:54 +01:00
Marten Seemann
5a1a34df37 implement server-side path validation logic (#4944) 2025-02-12 13:50:11 +01:00
Marten Seemann
f20b823154 proxy: optimize packet sorting logic (#4923) 2025-01-26 05:27:12 +01:00
Marten Seemann
3e87ea3f50 proxy: add function to simulate NAT rebinding (#4922) 2025-01-26 05:03:08 +01:00
Marten Seemann
79bae396b4 proxy: rename to Proxy, refactor initialization (#4921)
* proxy: rename to Proxy, refactor initialization

* improve documentation
2025-01-25 11:13:33 +01:00
Marten Seemann
f5145eb627 proxy: remove QuicProxy.LocalPort method (#4920) 2025-01-25 04:18:22 +01:00
Marten Seemann
bea70c6489 fix flaky TestALPN integration test (#4909) 2025-01-21 20:04:26 +08:00
Marten Seemann
07bbe8c383 add ErrTransportClosed and use it for Listen/Dial after transport close (#4883)
* add ErrTransportClosed and use it for Listen/Dial after transport close

* include the original error in the ErrTransportClosed error string
2025-01-21 13:54:40 +08:00
Roccoon
96ce54e83f http3: add client trace support (#4749)
Since the QUIC connection establishment process includes TLS handshake logic,
Connect and TLS handshake are called in the following order:

ConnectStart -> TLSHandshakeStart -> TLSHandshakeDone -> ConnectDone.

Notice: Wait100Continue not implemented as quic-go doesn't support handling
Expect: 100-continue.
2025-01-14 12:50:16 +08:00
Marten Seemann
61adb85052 use testing.T.Tempdir and Setenv in QLOGDIR integration test (#4868) 2025-01-13 10:02:13 +08:00
Marten Seemann
420f852f86 drain server's accept queue before returning ErrClosed from Accept (#4846) 2025-01-08 21:59:05 +08:00
Marten Seemann
c42f8456ab optimize packetization of DATA_BLOCKED frames (#4845)
DATA_BLOCKED frames should be sent in the same as the STREAM frames that
resulted in the connection becoming blocked on connection flow control.
If there's not enough space left in that packet, the DATA_BLOCKED frame
is sent in the next packet.
2025-01-08 11:41:10 +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
eec74b14c6 fix errors.Is for StreamError and DatagramTooLargeError (#4825) 2024-12-29 17:56:38 +08:00
Marten Seemann
52757a97e9 fix flaky MITM packet corruption test (#4821) 2024-12-28 19:39:17 +08:00
Marten Seemann
9cf118fc82 fix flaky MITM packet injection test (#4810)
Instead of transferring data in one direction, we should echo the data
sent. This makes sure that a roughly equal number of packets is sent in
each direction.
2024-12-28 15:38:54 +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
a584e58099 flowcontrol: reset the connection send window when 0-RTT is rejected (#4764) 2024-12-22 11:36:14 +08:00
Marten Seemann
95998056d5 update GoMock to v0.5.0 (#4776) 2024-12-21 10:56:18 +08:00
Marten Seemann
468cea250d fix flaky non-QUIC packet multiplexing test (#4766) 2024-12-19 11:32:50 +08:00
Marten Seemann
408ba9f053 use a 24h maximum token age if Transport.MaxTokenAge is unset (#4763) 2024-12-18 19:44:03 +08:00
Marten Seemann
32c9c81962 improve stream limit 0-RTT integration test (#4761) 2024-12-18 14:34:48 +08:00
Marten Seemann
0192a17a3d fix flaky multiplex integration test (#4760) 2024-12-18 14:07:03 +08:00