Commit Graph

6879 Commits

Author SHA1 Message Date
Marten Seemann
fea19fc3ec update to Go 1.25, drop Go 1.23, use go tool for gomock (#5283)
* update to Go 1.25, drop support for Go 1.23

* ci: update golangci-lint to v2.4.0

* use new go tool command for gomock / mockgen

* also update Go version used for oss-fuzz
2025-08-16 06:14:01 +02:00
Marten Seemann
fee90a89ef ackhandler: generalize check for missing packets below threshold (#5260)
* ackhandler: check for missing packets below reordering treshold

No functional change expected.

With the Acknowledgement Frequency extension, the reordering threshold
will become configurable. With this change, it will be easy to use the
peer-requested value instead of the predefined constant.

* improve documentation

* call HighestMissingUpTo in randomized test
2025-08-14 16:51:24 +02:00
Marten Seemann
da27fcf33f expose basic connection stats via Conn.ConnectionStats (#5281)
* Add ConnectionStats

* remove for loop

* Add comments

* Update comments

---------

Co-authored-by: Marco Munizaga <git@marcopolo.io>
2025-08-13 16:45:14 +02:00
WeidiDeng
e0a836f597 fix documentation for EarlyListener.Close (#5284)
* quic: update documentaion for EarlyListener.Close

* fix missing space

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-08-13 22:26:26 +08:00
WeidiDeng
f0042715d7 http3: fix documentation for Server.ServeListener (#5282) 2025-08-12 16:14:09 +02:00
Marten Seemann
7e636553d6 fix repeated initialization of outgoingPathManager in Conn.AddPath (#5280)
In case of concurrent calls, this may still be called multiple times.

Co-authored-by: Marco Munizaga <git@marcopolo.io>
2025-08-12 22:00:08 +08:00
Benjamin M. Schwartz
c7cf12703d quicvarint: tolerate empty reads of the underlying io.Reader (#5275)
* Tolerate empty reads in `quicvarint.Read`

Currently, `quicvarint.Read` misinterprets an empty read (`n==0`)
as a single zero byte.  While empty reads are "discouraged" in
the `io.Reader` interface, they do sometimes happen, especially
when using `io.Pipe()`.

This change tolerates empty reads, adds a corresponding unit test,
and also includes some additional test coverage related to empty
capsules

* minor test refactor

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-08-05 08:05:52 +02:00
Marten Seemann
fa8ca045dd quicvarint: extend benchmark to use quicvarint.Reader (#5278)
* quicvarint: extend benchmark to use quicvarint.Reader

* rename variable
2025-08-05 07:49:55 +02:00
Marten Seemann
5422e4c68c ackhandler: remove unused time from receivedPacketHandler.ReceivedPacket (#5277)
* ackhandler: remove unused time from receivedPacketHandler.ReceivedPacket

No functional change expected.

* fix typo

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* also fix typo in tests

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-05 06:03:02 +02:00
Marten Seemann
69cbb6ec5b qlog: add support for ACK_FREQUENCY and IMMEDIATE_ACK frames (#5276) 2025-08-04 10:00:02 +02:00
Jannis Seemann
2db5f56cc5 fix missing log statement for STREAM, DATAGRAM and ACK (#5273) 2025-08-01 01:37:13 +02:00
Marten Seemann
0a22da7e03 wire: add support for the min_ack_delay transport parameter (#5266)
* wire: implement parsing and writing of the min_ack_delay transport parameter

* wire: validate the min_ack_delay transport parameter
2025-07-24 15:43:34 +02:00
Jannis Seemann
9ae5267916 fuzzing: fix timeout in frame parser (#5268) 2025-07-22 17:45:00 +02:00
Marten Seemann
b69abbaf11 wire: implement parsing and writing of the IMMEDIATE_ACK frame (#5265) 2025-07-21 15:56:04 +02:00
Marten Seemann
06e31852cb wire: implement parsing and writing of the ACK_FREQUENCY frame (#5264)
* implement parsing and writing of the ACK_FREQUENCY frame

* prevent overflows of Request Max Ack Delay

* fix fuzzer
2025-07-21 15:35:06 +02:00
Jannis Seemann
c2e784aaf2 wire: optimize parsing logic for STREAM, DATAGRAM and ACK frames (#5227)
ParseOtherFrames-16       148ns ± 4%     150ns ± 3%     ~     (p=0.223 n=8+8)
ParseAckFrame-16          302ns ± 2%     298ns ± 3%     ~     (p=0.246 n=8+8)
ParseStreamFrame-16       262ns ± 3%     213ns ± 2%  -18.61%  (p=0.000 n=8+8)
ParseDatagramFrame-16     561ns ± 5%     547ns ± 4%     ~     (p=0.105 n=8+8)
v0.54.0
2025-07-20 13:14:38 +02:00
Jannis Seemann
893a5941fb wire: improve frame parsing benchmarks (#5263)
* Add master-style frame handling benchmarks using type switches

* Fixing styling issue.

* put STREAM frame back

* remove BenchmarkParseStreamAndACK

* use random data for STREAM and DATAGRAM

* improve comment

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-07-18 18:33:04 +02:00
Coia Prant
afe01ef103 close Transport when DialAddr fails (#5259)
Close the transport after dial fails to avoid memory leaks. Same logic as DialAddrEarly.

Signed-off-by: Coia Prant <coiaprant@gmail.com>
2025-07-12 18:58:30 +02:00
Robin Thellend
0a9c6ea4c8 http3: remove dependency on quic internal packages (#5256)
* Remove http3 dependency on quic internal packages

Remove the dependency on internal/protocol from the http3 package. This
makes it possible for a forked http3 to use the mainline quic-go
package.

* Address review comments

* Fix syntax

* Use broader pattern for http3 directory

* Copy internal/testdata

* Replace perspective with bool

* clone the supported version slice

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-07-07 13:41:23 +02:00
Marten Seemann
fd32cf5c69 fix flaky TestPostQuantumClientHello (#5253) 2025-06-29 07:09:45 +02:00
Marten Seemann
0eb237f797 add a Config and ConnectionState flag for RESET_STREAM_AT (#5243)
* add a Config and ConnectionState flag for RESET_STREAM_AT

* add RESET_STREAM_AT to README
2025-06-29 05:42:02 +02:00
Marten Seemann
61d2fa57ac http3: fix flaky TestConnGoAwayFailures (#5252) 2025-06-28 20:28:07 +02:00
Marten Seemann
dadc8db836 fix flaky TestServerReceiveQueue (#5249) 2025-06-28 15:19:28 +02:00
Marten Seemann
3f3d3099b7 fix flaky TestDrainServerAcceptQueue (#5247)
The connections are not necessarily accepted in the same order that
they are dialed.
2025-06-28 09:37:18 +02:00
Marten Seemann
08e9c7e7ac fix flaky TestTransportReplaceWithClosed (#5245) 2025-06-28 09:09:36 +02:00
Marten Seemann
a2926a3603 implement sender side behavior for RESET_STREAM_AT (#5242)
* improve existing send stream test

* implement sender side behavior for RESET_STREAM_AT

* refactor send stream cancelation and shutdown error handling

* correctly deal with 0-RTT corner case
2025-06-28 05:44:47 +02:00
Marten Seemann
b2f24318af implement receiver side behavior for RESET_STREAM_AT (#5235)
* implement receiver side behavior for RESET_STREAM_AT

* simplify reliable offset tracking
2025-06-26 08:42:08 +02:00
Marten Seemann
1b9add1bec fix retransmission logic for path probing packets (#5241)
To achieve an exponential backoff, the timer should only be reset after
having fired.
2025-06-26 07:49:44 +02:00
Jannis Seemann
b94fc4d2d4 quicvarint: speed up parsing of 1, 2 and 4 byte varints (#5229) v0.53.0 2025-06-24 15:42:13 +02:00
Marten Seemann
e629a12d06 drain server accept queue when the transport is closed (#5237)
* drain server queue on transport close

* add integration test for clearing conn queue

* improve documentation and test for Transport.Close

* move to handshake_test.go

---------

Co-authored-by: sukun <sukunrt@gmail.com>
2025-06-24 15:20:23 +02:00
sukun
cf97a0a39c fix deadlock when closing the Transport (#5220)
* transport: fix deadlock on close

The lock ordering is Transport.mutex before connMx. This deadlocks
some times in tests.
For the latest one:
https://github.com/libp2p/go-libp2p/actions/runs/15534001571/job/43728863965?pr=3305

* remove connMx

* release mutex for server close

* Update server.go

---------

Co-authored-by: Marten Seemann <martenseemann@gmail.com>
2025-06-24 13:55:42 +02:00
Marten Seemann
92aa7b41d5 handshake: store key update interval in an atomic (#5234)
* handshake: store key update interval in an atomic

We recently changed the way the key update interval is set in tests to
use an environment variable. This resolved a race condition that existed
in the earlier logic, however, parsing of the environment variable now
shows up in benchmark tests.

Using an atomic variable should have a negligible performance impact.

* use an atomic swap
2025-06-21 12:14:07 +02:00
Marten Seemann
4bc9dfca93 improve documentation for the various error types (#5233) 2025-06-21 09:23:29 +02:00
Marten Seemann
b9d934ff8b http3: tighten checks for incorrect use of RequestStream (#5231)
The RequestStream is a low-level API that’s used by WebTransport,
CONNECT-UDP and CONNECT-IP. Methods on the RequestStream must be called
in a certain order, and we should detect misuse of the API.
2025-06-20 09:55:11 +02:00
Marten Seemann
7d5e0570c4 http3: avoid reinitilising the frame parser on the stream (#5232)
No functional change expected.
2025-06-20 07:34:03 +02:00
Marten Seemann
f27b056998 http3: remove deprecated RoundTripper (#5230) 2025-06-20 05:44:53 +02:00
Marten Seemann
66e2539b2e http3: explicitly expose all method on the RequestStream (#5216) 2025-06-19 12:16:26 +02:00
Marten Seemann
f16ffc6d16 http3: add ClientConn.Context, CloseWithError and Conn (#5219) 2025-06-17 18:29:27 +02:00
Marten Seemann
e536ee6ebb ci: add Go 1.25rc1 to tested Go versions (#5224)
* ci: add Go 1.25rc1 to tested Go versions

* fix rc name
2025-06-17 05:13:09 +02:00
Marten Seemann
d33d293fd2 ci: enable the usetesting linter (#5222)
This linter is useful to detect the creation of temporary directories
and the setting of environment variables in tests.
2025-06-11 09:39:07 +02:00
Marten Seemann
aa22706d78 ci: enable the nolintlint linter (#5221)
This linter helps us find unneeded nolint statements.
2025-06-11 06:52:21 +02:00
Marten Seemann
01921ede97 rename Conn receiver variable (#5215)
No functional change expected.
2025-06-09 13:48:36 +02:00
Marten Seemann
39f6e120c0 http3: remove deprecated SingleDestinationRoundTripper type (#5217) 2025-06-09 13:46:53 +02:00
Marten Seemann
6c82ac07cf http3: convert Connection interface to Conn struct (#5204) 2025-06-09 12:16:07 +02:00
Marten Seemann
5f3d617dec convert Connection interface to Conn struct (#5195) 2025-06-09 11:51:46 +02:00
Marten Seemann
eb08018a5c explictly expose all method on the Stream (#5214)
This hides the fact that a Stream is composed of a ReceiveStream and a
SendStream. This is an implementation detail and should not be exposed.
2025-06-09 11:14:58 +02:00
Marten Seemann
1b07674b19 handle stream-related frame in the streams map (#5212)
* handle stream-related frame in the streams map

* remove stream manager interface and mock
2025-06-09 10:00:46 +02:00
Marten Seemann
4f23ac2752 remove connection flow controller mock (#5213)
No functional change expected.
2025-06-09 09:26:23 +02:00
Marten Seemann
6f2a3f1a1c ci: enable Codecov test analysis (#5210)
* ci: enable Codecov test analysis

* ci: set package name for pre-built test binary
2025-06-09 09:09:30 +02:00
Marten Seemann
41fce88a63 simplify stream ID handling in the outgoing streams map (#5209)
No functional change expected.
2025-06-08 14:27:14 +02:00