Commit Graph

111 Commits

Author SHA1 Message Date
dignifiedquire c8a655c4b4 Merge remote-tracking branch 'upstream/main' into chore-merge-upstream 2025-12-01 14:08:32 +01:00
Dirkjan Ochtman 80b8ffdb4b Use newer rustls-pki-types PEM parser API 2025-09-02 17:46:40 +00:00
Floris Bruynooghe 143eb1b815 Merge branch 'main' into multipath-quinn-0.11.x 2025-08-02 17:14:02 +02:00
Dirkjan Ochtman 8339ef3ccc Upgrade rcgen to 0.14 2025-07-02 19:27:49 +00:00
Floris Bruynooghe deba4ee85f Merge branch 'main' into multipath-quinn-0.11.x 2025-04-10 12:36:01 +02:00
Dirkjan Ochtman a8807131e4 Switch to 2024 style 2025-02-23 11:52:46 +00:00
Diva M a935ad4df0 Merge commit '6ee883a2' into iroh-0.11.x 2025-01-14 23:05:01 -05:00
Lars Eggert f8b8c5032e chore: Fix cargo clippy issues 2024-11-18 23:31:18 +00:00
Diva M 94e970d4d6 feat: QUIC Address discovery extension (#12)
add frame types

transport parameter encoding and decoding - to my best understanding

fix typo

add some utility functions

add initial observed address frames

add frame encoding and decoding

adjust stats

minimal debugging for received observed addr

simplify setting extension in transport parameter

rework frame structure and send observed addr frames with path challenge ones

tweak example to start testing

fix encoding, send with handshake

clippy

fix docs

reject observed addr frames when not negotiated

replace request_id with seq_no according to new spec

replace code point for transport parameter

replace code point for frames

remove sending observed address frame in handshake in server side

treat as probing frame in payload processing

ack is already managed by is_ack_eliciting

send with path_response as well

add frame to retransmits and ignore old frames

send observed addr at least once per path

fmt

reword comment

remove trailing whites

keep observed address reports per path

remove addressed TODO

small improvement in readability

add retransmission with fresh info

retransmit just once

fix should send logic

add observed addr event

surface the info

restore trace level of frames

some extra logs

rename roles and var

improve error msg

assuming the default as disabled is ok, remove comment

use safe arithmetic with varints for the seq_no

move transport param code to method instead of From impl

fix example, finally

remove excesive log

add helper fn

carry old report into new path

generate notification only on changed values

downgrade log

add sending test

add resumption test on the acceptance case

add resumption test on the rejection case

spelling

actual spelling and undo debug change

dumb lints

some spelling and formatting

add retransmission test

make a bit more readable

update hexas

make naming consistent, add test

check docs for consistency
2024-11-04 11:07:38 -05:00
Floris Bruynooghe f13a28921a Rename to iroh-quinn
This does the rename to iroh-quinn for the 0.11.2 release code.
2024-06-21 13:00:40 +02:00
Benjamin Saunders b42e21e74d Make SendStream::finish synchronous
`await`ing on this was error-prone and not very useful, since it gave
little insight into application state, and was redundant to `stopped`.
2024-05-03 11:52:44 -07:00
gabrik ce13559778 proto: validate ServerConfig crypto provider
Signed-off-by: gabrik <gabriele.baldoni@gmail.com>
2024-04-22 09:45:53 +02:00
Dirkjan Ochtman e6d48970af proto: validate ClientConfig crypto provider
Co-authored-by: gabrik <gabriele.baldoni@gmail.com>
2024-04-22 09:45:53 +02:00
Dirkjan Ochtman 3be1ab5ab2 Upgrade to rcgen 0.13 2024-04-22 09:45:53 +02:00
Dirkjan Ochtman a85a4c12ee Update rustls to 0.23 and ring to 0.17 2024-04-22 09:45:53 +02:00
Phoenix Kahlo ff487f01c8 Demonstrate connection limiting in example
This commit adds a new --connection-limit option to the server example
to illustrate how a user could implement a limit to the number of
connections open at a time with the new "incoming" API and
Endpoint::open_connections method rather than with the now-removed
concurrent_connections ServerConfig parameter.
2024-04-03 10:02:29 +02:00
Phoenix Kahlo 75c0e0192a Demonstrate IP blocking in example
This commit adds a new --block option to the server example to
illustate in a simplified way the general structure one would use to
implement IP address blocking with the new accept/reject/retry API.

For example:

    cargo run --example server ./ --listen 127.0.0.1:4433 --stateless-retry --block 127.0.0.1:8065
    cargo run --example client https://127.0.0.1:4433/Cargo.toml --host localhost --bind 127.0.0.1:8065

One thing to note is that that example places the reject condition
before the retry condition. This expends slightly less effort rejecting
connections, but does create a blocked IP address oracle for an attacker
who can do address spoofing.
2024-04-03 10:02:29 +02:00
Phoenix Kahlo 54d5d60b42 Allow accept/refuse/retry before handshake begins
This commit removes use_retry from the server config and provides a
public API for the user to manually accept/refuse/retry incoming
connections before a handshake begins, and inspect properties such as
an incoming connection's remote address and whether that address is
validated when doing so.

In quinn-proto, Incoming is made public, as well as Endpoint's accept/
refuse/retry methods which operate on it. The
DatagramEvent::NewConnection event is modified to return an incoming
but not yet accepted connection.

In quinn, awaiting Endpoint::accept now yields a new
quinn::Incoming type, rather than quinn::Connecting. The new
quinn::Incoming type has all the methods its quinn_proto equivalent has,
as well as an accept method to (fallibly) transition it into a
Connecting, and also refuse, retry, and ignore methods.

Furthermore, quinn::Incoming implements IntoFuture with the output type
Result<Connection, ConnectionError>>, which is the same as the Future
output type of Connecting. This lets server code which was
straightforwardly awaiting the result of quinn::Endpoint::accept work
with little to no modification.

The test accept_after_close was removed because the functionality it
was testing for no longer exists.
2024-04-03 10:02:29 +02:00
Benjamin Saunders 044eab53ff Update clap 2023-05-11 14:10:19 +02:00
Benjamin Saunders 092a7686a4 Enable PMTUD by default when appropriate 2023-05-06 08:05:17 +02:00
Adolfo Ochagavía 2d48482180 Use PLPMTUD in bench, perf and examples
Sponsored by Stormshield
2023-04-04 17:40:20 -07:00
Benjamin Saunders 90a99193a9 Borrow self in read_to_end, rather than consuming
Allows `RecvStream::stop` to be called with custom error codes if
`ReadToEndError::TooLong` is encountered.
2023-03-05 08:52:31 +01:00
Dirkjan Ochtman f7354ef6ac Inline format arguments 2023-02-27 07:34:35 +01:00
StygianLightning 0d366990f1 Removed an obsolete lint control annotation.
The lint issue that made the workaround necessary has been resolved.
2022-12-10 11:07:03 -08:00
Benjamin Saunders 641114a69d Fix clippy lints 2022-11-14 01:17:22 -08:00
Benjamin Saunders 7d51d2e57e Remove Incoming stream in favor of Endpoint::accept 2022-10-23 08:18:42 +02:00
Benjamin Saunders 6e4bcbb2fc Drop NewConnection in favor of simpler API 2022-09-27 11:08:26 +02:00
Benjamin Saunders fe93a68108 Replace structopt with its successor, clap 3 2022-07-03 21:02:33 +02:00
François Garillot f731019c83 Clean up a few Option/Result patterns that fit an std combinator 2022-01-29 13:00:48 -08:00
Benjamin Saunders 19b58cc948 Drop futures-util dev-dependency
This wasn't serving any purpose we couldn't more readably accomplish
with async/await.
2021-12-29 07:34:22 +01:00
Benjamin Saunders 7ed94be3e4 Provide inherent next methods on streams
Allows for convenient use in async blocks by downstream code without a
futures_util dependency.
2021-12-21 07:03:27 +01:00
BiagioFesta 25d9a40bf9 followup: rename "stateless retry" -> "retry"
Fix compile error in quinn-proto after field rename
2021-11-06 13:11:56 +01:00
Benjamin Saunders b923c4c8b0 Pass SocketAddr by value
We always consume this by value in the end, and it's a little more
ergonomic.
2021-10-29 20:12:45 +02:00
Benjamin Saunders 5d1b6a101b Remove EndpointBuilder
Now that rustls configuration is more straightforward, this is not
adding significant value.
2021-10-29 20:12:45 +02:00
Benjamin Saunders 34ca6cff61 Privatize crypto config helpers
We're now sufficiently compatible with rustls defaults that these
aren't worth the API surface area.
2021-10-29 08:02:13 +02:00
Benjamin Saunders 495d2927cb Remove certificate newtypes 2021-10-29 08:02:13 +02:00
Benjamin Saunders 4927355049 Remove config builders
These aren't significantly more convenient than working with rustls
directly at this point.
2021-10-27 17:49:48 -07:00
Benjamin Saunders a384ee2edb Erase crypto::Session::HandshakeData 2021-10-27 17:49:48 -07:00
Dirkjan Ochtman fed3c5cb39 Require explicit construction of ServerConfigs 2021-09-29 10:12:44 -07:00
Chris Connelly e63dd77376 Make TransportConfig setters infallible
For most setters this was just a case of changing the signature to take
a `VarInt`.

`max_idle_timeout` was a bit more involved in order to maintain a usable
conversion from `Duration`. The internal representation was changed from
`Duration` from `VarInt`, and an `IdleTimeout` newtype was introduced
for the setter signature. `IdleTimeout` contains a `VarInt`-encoded
millisecond value, and has a fallible conversion from `Duration`. The
use of a newtype is preferable to a direct `Duration` -> `VarInt`
encoding since there could be other `VarInt`-encoded values in future
that use a different resolution than milliseconds.

These changes allow callers to avoid the type-level possibility of error
if they have a `VarInt` (or a value that can be converted infallibly
into one). Fallible conversion from `VarInt` is still convenient with
`TryInto`, and callers can handle the conversion errors without the
indirection of `ConfigError`.

Closes #1176.

BREAKING CHANGE: The `max_concurrent_bidi_streams`,
`max_concurrent_uni_streams`, `stream_receive_window`, and
`receive_window` methods on `TransportConfig` now take `VarInt`
arguments and return `&mut Self`. `TransportConfig::max_idle_timeout`
now takes an `IdleTimeout` argument and returns `&mut Self`.
2021-09-19 18:30:43 -07:00
Marcel Märtens b224d1d0fa switch to futures_utils in tests and benches, also use futures_utils isntead of futures_core 2021-08-11 10:27:32 +02:00
Benjamin Saunders 14813d33c2 Remove unintentional, obfuscatory use of Result::into_iter 2021-03-21 22:27:17 +01:00
Benjamin Saunders 612c9ac2b8 Remove unnecessary dropping in client/server examples 2021-01-26 06:46:32 +01:00
Benjamin Saunders 1e5a538221 Limit concurrent streams rather than accept queue size
Previously, we limited the number of streams that could be opened by
the peer but not `accept`ed by the application. However, to guarantee
bounded resource use, applications will typically want to limit the
number of streams they process concurrently. While this could
be *approximately* implemented at the application layer by controlling
calls to accept, that approach has a significant drawback: If streams
are slow to process, the worst-case per-stream latency observed by a
peer who opens the maximum number of streams can be arbitrarily bad,
because streams may be opened above the limit the local application is
willing to process. Reducing the number of unaccepted streams
tolerated can reduce the proportion of streams affected, but reducing
it too low will increase the number of round trips required to open
any given number of streams, increasing average latency significantly.

As a side benefit, this reduces the effort needed for applications to
limit concurrency to a fixed quantity, which is expected to be the
overwhelmingly common case. Should a use case for dynamic concurrency
limits arise, we can expose a setter.
2021-01-22 11:39:00 -08:00
Dirkjan Ochtman 17fe82b598 Apply clippy fixes for 1.49 2021-01-01 11:16:05 -08:00
Dirkjan Ochtman 4420b61aaa quinn: print socket addresses in example client/server 2020-12-11 16:17:48 -08:00
Timon 83cff80908 Create example README (#910) 2020-11-15 21:43:28 +01:00
Matthias Einwag 4c9c0dc3c6 Use vectors instead of boxed slices
Use vectors instead of boxed slices

The conversion from Vec<u8> into Box<[u8]> is not always for free.
It will call `Vec::into_boxed_slice`, which will call `shrink_to_fit`.
https://github.com/rust-lang/rust/blob/28f03ac4c08fc7ec62428d0b914e1510ce7ee2cb/library/alloc/src/vec.rs#L689

If the `Vec` isn't fully utilized before, this will cause a reallocation
and a copy of all data. This might currently happen with every
outgoing packet.

This change simply keeps things as `Vec<u8>`, which works just fine since
the IO layer can deal with it.
2020-10-31 10:27:00 -07:00
Dirkjan Ochtman d5b47f601d Unwrap unused results from invalid config values 2020-10-12 12:13:50 -07:00
Dirkjan Ochtman f212256435 Clean up warnings/errors 2020-09-03 09:17:32 -07:00