Commit Graph

938 Commits

Author SHA1 Message Date
Floris Bruynooghe 3360856d1a convert to our test changes 2025-05-22 16:11:06 +02:00
Floris Bruynooghe 2d54bac314 Merge branch 'main' into multipath-quinn-0.11.x 2025-05-22 16:00:22 +02:00
Phoenix Kahlo 41facf3861 Fix large RetryError clippy warnings
Clippy is warning that the size of RetryError (both proto and quinn's
versions) are excessively large for a Result Err variant. This function
fixes these warnings by boxing the contents of both.
2025-05-19 07:16:01 +00:00
Phoenix Kahlo 4f8a0f13cf refactor(quinn): Remove some usage of execute_poll
This commit makes there be fewer places where SendStream::execute_poll
is called directly. AsyncWrite implementations now go through poll_write,
and poll_write now goes through the write future. This means that
execute_poll is now only called directly from write and write_chunks.
2025-05-14 10:31:48 +00:00
Frando f1fe1832a7 feat: Make the future returned from SendStream::stopped 'static
Changes the implementation of `SendStream::stopped` such that the
returned future is static and no longer lifetime-bound onto a mutable
reference to the send stream.

This allows to use the stopped future with combinators or in a separate
task while still sending on the stream concurrently.

Internally, this is done changing the implementation of the stopped
notification to use a cloneable tokio::sync::Notify instead of storing
a single waker.
2025-05-14 04:43:32 +00:00
Phoenix Kahlo bce32845dc quinn: Remove explicit write future structs
We maintain explicit send stream future implementation structs for
`Write`, `WriteAll`, `WriteChunk`, and `WriteAllChunks`. However, these
are private. We can significantly simplify this code by instead leaning
more directly on functionality such as async functions and
`std::future::poll_fn`.
2025-05-11 17:35:45 +00:00
Phoenix Kahlo 14b905ae56 quinn: Fix feature combination error / warnings
Commit fixes compile errors and warnings that previously occurred with
certain combinations of features that our CI was not catching.
2025-05-09 01:01:17 +00:00
Dirkjan Ochtman 3482fcc759 proto: bump version to 0.11.12 2025-05-08 17:43:40 +00:00
David Lönnhager d161fc07d7 Bump quinn version to 0.11.8 2025-05-08 14:37:03 +00:00
Phoenix Kahlo 15103ee887 Add BloomTokenLog
- Adds default feature `bloom`.
- It enables a new BloomTokenLog implementation of TokenLog.
- It enables a dependency on the `fastbloom` crate.
2025-05-07 04:37:29 +00:00
Phoenix Kahlo 0b5762efaa Add TokenMemoryCache
TokenMemoryCache is a new implementation of TokenStore.

TokenMemoryCache is designed to store up to 2 tokens per server (this is
configurable) for up to 256 servers (this is also configurable), with a
LRU eviction policy. This is so that it works harmoniously with
rustls::ClientSessionMemoryCache, which by default stores resumption
state for up to 256 servers with a LRU eviction policy.
2025-05-07 02:36:17 +00:00
Phoenix Kahlo 37beebfa08 docs(quinn): Copy edit poll_read(_buf?) docs
Looks to the following for writing inspiration:

- https://docs.rs/tokio/latest/tokio/io/trait.AsyncRead.html#tymethod.poll_read
- https://doc.rust-lang.org/stable/std/io/trait.Read.html#tymethod.read

Achieves:

- Reflowing to 100 columns.
- Style-consistency with code-escaping and initial-line period.
- Distinguishing first lines between the two methods' doc comments.
- Hyperlink to SendStream::finish
- General writing style.
2025-04-20 05:17:25 +00:00
Floris Bruynooghe deba4ee85f Merge branch 'main' into multipath-quinn-0.11.x 2025-04-10 12:36:01 +02:00
Filipe Cantarelli f8165c3394 refactor: move max_datagrams limit at poll_transmit from quinn-proto to quinn 2025-03-28 16:49:04 +00:00
Benjamin Saunders 94309722fd Bump quinn-proto dependency edge
We depend on new APIs, e.g. for token logs.
2025-02-23 21:27:04 +00:00
Olivier Kannengieser 161274f417 Makes poll_read_buf public 2025-02-23 20:26:32 +00:00
Dirkjan Ochtman 04d8781964 Use ready!() from std 2025-02-23 11:52:46 +00:00
Dirkjan Ochtman a8807131e4 Switch to 2024 style 2025-02-23 11:52:46 +00:00
Dirkjan Ochtman 1ef5e02afd Apply suggestions from clippy 1.85 2025-02-23 11:52:46 +00:00
Dirkjan Ochtman f4172ea3a2 Upgrade to rand 0.9 2025-01-30 23:29:12 +00:00
Philipp Krüger 13decb40b3 fix(quinn): impl tokio::io::AsyncWrite for SendStream 2025-01-28 07:59:12 +00:00
Phoenix Kahlo af2c1fa75d Allow client to use NEW_TOKEN frames
When a client receives a token from a NEW_TOKEN frame, it submits it to
a TokenStore object for storage. When an endpoint connects to a server,
it queries the TokenStore object for a token applicable to the server
name, and uses it if one is retrieved.

As of this commit, the only provided implementation of TokenStore is
NoneTokenStore, which is equivalent to the lack of a token store, and is
the default.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 195a781dde Allow server to use NEW_TOKEN frames
When a path becomes validated, the server may send the client NEW_TOKEN
frames. These may cause an Incoming to be validated.

- Adds TokenPayload::Validation variant
- Adds relevant configuration to ServerConfig
- Adds `TokenLog` object to server to mitigate token reuse

As of this commit, the only provided implementation of TokenLog is
NoneTokenLog, which is equivalent to the lack of a token log, and is the
default.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 9e1f77cf9f Create Incoming.may_retry API
The ability for the server to process tokens from NEW_TOKEN frames will
create the possibility of Incoming which are validated, but may still be
retried. This commit creates an API for that. This means that rather
than Incoming.remote_address_validated being tied to retry_src_cid, it
is tied to a new `validated: bool` of `IncomingToken`.

Currently, this field is initialized to true iff retry_src_cid is some.
However, subsequent commits will introduce the possibility for
divergence.
2025-01-26 18:40:40 +00:00
Philipp Krüger c443147a2e Prefer sleep instead of sleep_until with Instant::now 2025-01-22 04:25:48 +00:00
Philipp Krüger a5e9504952 feat(quinn,quinn-udp): Disable socket2 and std::net::UdpSocket dependencies in wasm/browser targets 2025-01-22 04:25:48 +00:00
Carl Dong cc1cf6ff96 Add comments w/re keeping features in sync 2025-01-18 20:56:41 +00:00
Floris Bruynooghe b6b7312907 Add a test that check multipath gets negotiated properly. (#30) 2025-01-16 09:36:01 -05:00
Diva M a935ad4df0 Merge commit '6ee883a2' into iroh-0.11.x 2025-01-14 23:05:01 -05:00
Phoenix Kahlo ea82621806 Remove various obselete allow directives 2024-12-22 22:10:49 +00:00
Phoenix Kahlo c249f9e838 Remove use self:: occurrences 2024-12-21 19:39:30 +00:00
Phoenix Kahlo e7b5c6c1aa Rename initiate_key_update -> force_key_update 2024-12-21 08:19:05 +00:00
Phoenix Kahlo 5992acf403 Un-hide force_key_update / initiate_key_update 2024-12-21 08:19:05 +00:00
Phoenix Kahlo 506e74417a quinn: Make SendStream::poll_stopped private
Previously, this method was public, but marked as `#[doc(hidden)]`.
However, nothing anywhere was using it. This commit makes it private.
2024-12-20 19:45:30 +00:00
Phoenix Kahlo 870375cc83 Implement Default for ClosedStream
This allows us to remove the `#[doc(hidden)] pub fn new() -> Self`.
2024-12-20 19:39:34 +00:00
Phoenix Kahlo 51606c6e34 Make SystemTime mockable via object
- Adds trait TimeSource
- Adds default implementation StdSystemTime
- Adds ServerConfigParameter time_source: Arc<dyn TimeSource>
- Replaces all SystemTime::now calls in proto with TimeSource.now calls
  (there were 2)

This is a backwards-compatible change.
2024-12-17 08:22:09 +00:00
Phoenix Kahlo 73545b65b3 Adjust terminology regarding tokens
RFC 9000 presents some unfortunate complications to naming things. It
introduces a concept of a "token" that may cause a connection to be
validated early. In some ways, these tokens must be treated discretely
differently based on whether they originated from a NEW_TOKEN frame or
a Retry packet. It also introduces an unrelated concept of a "stateless
reset token".

If our code and documentation were to constantly use phrases like "token
originating from NEW_TOKEN frame," that would be extremely cumbersome.
Moreover, it would risk feeling like leaking spec internals to the user.

As such, this commit tries to move things towards the following naming
convention:

- A token from a NEW_TOKEN frame is called a "validation token", or
  "address validation token", although the shorter form should be used
  most often.
- A token from a Retry packet is called a "retry token".

  We should avoid saying "stateless retry token" because this phrase is
  not used at all in RFC 9000 and is confusingly similar to "stateless
  reset token". This commit changes public usages of that phrase.
- In the generic case of either, we call it a "token".
- We still call a stateless reset token a "reset token" or "stateless
  reset token".
2024-12-15 06:23:50 +00:00
Phoenix Kahlo 04b9611aff docs(quinn): Tweak Connecting docs 2024-12-15 06:05:34 +00:00
Phoenix Kahlo 8ab077dbce quinn: Remove obsolete must_use for futures 2024-12-15 06:05:09 +00:00
Phoenix Kahlo 05f6e67de6 Minor style changes
- Adds .zed to gitignore
- Doc comments tweaks
  - Consistent punctuation and width
  - Documenting defaults
  - Other tweaks
- Debug implementation tweaks
  - Elide fields via finish_non_exhaustive
  - Other tweaks
2024-12-14 20:02:50 +00:00
Phoenix Kahlo 6716b5a7b8 tests(quinn): Ignore stress tests by default 2024-12-13 20:35:53 +00:00
BigWingBeat 728a335454 Remove redundant nonblocking config on async-std 2024-12-06 18:13:33 +00:00
Asakura Mizu e318cc4a80 feat(quinn-udp): support illumos 2024-11-29 09:06:37 +00:00
Lars Eggert f8b8c5032e chore: Fix cargo clippy issues 2024-11-18 23:31:18 +00:00
Petr Sumbera 2cd3b14216 Add Solaris CI, plus disable failing Solaris tests for now (#1877) 2024-11-16 21:35:12 +00:00
Dirkjan Ochtman 7fa7dc220d Bump versions to prepare release 2024-11-16 21:32:39 +00:00
Dirkjan Ochtman 37355ec5e7 quinn: avoid FIPS in docs.rs builds 2024-11-16 21:32:39 +00:00
Dirkjan Ochtman a9cee2102e Move docs.rs metadata to the bottom 2024-11-16 21:32:39 +00:00
Dirkjan Ochtman 66546ddd5a quinn: bump version to 0.11.6 2024-11-13 06:43:34 +00:00
Phoenix Kahlo eebccff309 quinn: Fix missing re-exports 2024-11-13 05:22:22 +00:00