Commit Graph

3859 Commits

Author SHA1 Message Date
dignifiedquire 0aaea29db5 avoid doubule box 2025-05-21 13:39:31 +02:00
Philipp Krüger c8253835ec Don't store Arc<dyn AsyncUdpSocket> in connection state anymore 2025-05-21 13:16:05 +02:00
Philipp Krüger 8a2dd46fc3 Implement a poll_send instead of poll_writable. 2025-05-21 13:08:17 +02:00
Philipp Krüger 6e869d4bb5 Turn UdpPoller into UdpSender 2025-05-21 12:47:43 +02:00
Philipp Krüger a8cca03aa9 feat: Update iroh-0.11.x to latest quinn main (#40) iroh-quinn-udp-v0.5.7 iroh-quinn-v0.13.0 iroh-quinn-proto-v0.13.0 2025-01-28 12:22:16 +01:00
Philipp Krüger 947d45a26e Update README with more infos on releases and branches 2025-01-28 12:02:19 +01:00
Philipp Krüger c5b556736c fix: Errors from merging 2025-01-28 10:52:48 +01:00
Philipp Krüger 6383307ac9 Merge remote-tracking branch 'upstream/main' into iroh-0.11.x 2025-01-28 10:27:33 +01:00
Philipp Krüger 13decb40b3 fix(quinn): impl tokio::io::AsyncWrite for SendStream 2025-01-28 07:59:12 +00:00
Phoenix Kahlo 69c00ebfdc test(proto): Fix wasm CI 2025-01-28 00:28:48 +00:00
Phoenix Kahlo bb54bc4a51 test(proto): Add tests for NEW_TOKEN frames
Also adds a `FakeTimeSource` utility to the test module.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo d2acbc3e94 test(proto): Create tests::token module
Moves the existing `stateless_retry` test into that module.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo ee29715215 test(proto): Enable NEW_TOKEN usage in tests
Configures the default clients and servers in proto tests to be able to
utilize NEW_TOKEN frames. This involves creating simple implementations
of token-related traits internal to the test module. These
implementations are essentially the most boring possible implementation
that is able to actually utilize tokens. They would not be suitable for
use in real applications because their memory usage is unbounded.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 5a572e067d test(proto): Refactor IncomingConnectionBehavior
When we first added tests::util::IncomingConnectionBehavior, we opted to
use an enum instead of a callback because it seemed cleaner. However,
the number of variants have grown, and adding integration tests for
validation tokens from NEW_TOKEN frames threatens to make this logic
even more complicated. Moreover, there is another advantage to callbacks
we have not been exploiting: a stateful FnMut can assert that incoming
connection handling within a test follows a certain expected sequence
of Incoming properties.

As such, this commit replaces TestEndpoint.incoming_connection_behavior
with a handle_incoming callback, and modifies an existing test to
exploit this functionality to test more things than it was previously.
2025-01-26 18:40:40 +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 78bfa5b509 proto: Convert TokenPayload into enum
As of this commit, it only has a single variant, which is Retry.
However, the next commit will add an additional variant. In addition
to pure refactors, a discriminant byte is used when encoding.
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
Phoenix Kahlo b237cd766e proto: Change how tokens are encrypted
Previously, retry tokens were encrypted using the retry src cid as the
key derivation input. This has been described by a reputable individual
as "cheeky" (who, coincidentially, wrote that code in the first place).
More importantly, this presents obstacles to using NEW_TOKEN frames.

With this commit, tokens carry a random 128-bit value, which is used to
derive the key for encrypting the rest of the token.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo 22c12708f0 proto: Split out RetryTokenPayload
Moves all the fields of Token to a new RetryTokenPayload struct, and
makes Token have a single `payload: RetryTokenPayload` field. This may
seem strange at first, but it sets up for the next commit, which adds
an additional field to Token.
2025-01-26 18:40:40 +00:00
Phoenix Kahlo df22e2772e proto: Rename RetryToken -> Token 2025-01-26 18:40:40 +00:00
Phoenix Kahlo 273f7c2386 proto: Factor out NewToken frame struct 2025-01-26 18:40:40 +00:00
Dirkjan Ochtman 2125b36a14 Simplify weirdly broken test code 2025-01-22 04:35:09 +00:00
Phoenix Kahlo d5e63d8c28 ci: powerset --clean-per-run 2025-01-22 04:25:48 +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 d7146d3a86 Remove redundant step names 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
Carl Dong 7d87dc9f6a fix(.github/codecov): Ignore aws-lc-rs-fips for codecov 2025-01-18 20:56:41 +00:00
Asmir Avdicevic d579a38fab chore: remove individual repo project tracking (#34) 2025-01-17 14:18:05 +01:00
Floris Bruynooghe aed5fab221 merge latest released (quinn-0.11.5) upstream (#27)
This brings us up to the latest quinn releases:
quinn-0.11.5
quinn-proto-0.11.8
quinn-udp-0.5.5
2025-01-15 12:12:56 +01:00
Floris Bruynooghe 19da2ea46e Do not test all features
This test takes forever and we run out of disk space doing it.  This
is a problem for upstream to handle, we're fine if things work for us.
2025-01-15 11:56:21 +01:00
Diva M e327770cc6 fix docs 2025-01-14 23:33:35 -05:00
Diva M ad76ba092a when fixes are bugs 2025-01-14 23:27:54 -05:00
Diva M 03108fe877 more fixes to workflows 2025-01-14 23:25:52 -05:00
Diva M 8cbeec3979 use iroh-* crate in new ci workflow 2025-01-14 23:20:52 -05:00
Diva M e708f3a631 fix missed in merge 2025-01-14 23:18:46 -05:00
Diva M 7640a8949e rm CODEOWNERS 2025-01-14 23:15:36 -05:00
Diva M a935ad4df0 Merge commit '6ee883a2' into iroh-0.11.x 2025-01-14 23:05:01 -05:00
Dirkjan Ochtman 6bfd24861e tests: avoid ICE in beta 2025-01-10 21:09:02 +00:00
Max Inden 3c3d460378 ci: run quinn-udp tests with fast-apple-datapath 2025-01-10 19:49:54 +01:00
Floris Bruynooghe 76e002c99b Describe how to find the upstream version 2025-01-09 14:25:45 +01:00
Dirkjan Ochtman e51d0e4b6b Add gretchenfrage as a quinn-udp owner 2025-01-07 15:03:30 +00:00
Max Inden fbc795e3ce fix(udp/windows): set socket option IP_RECVECN
Equivalent to https://github.com/quinn-rs/quinn/pull/2125 for IPv4.

On Windows, to enable ECN reporting on IPv4, one sets the `IP_RECVECN` socket
option. The Windows IP stack will then report ECN markings via the `IP_ECN`
message type.

Previously `quinn-udp` would use `IP_ECN` for both. With this commit
`IP_RECVECN` is used to set the socket option and `IP_ECN` is used to read the
option.

Given that both constants evaluate to the same value (i.e. `50`) the previous
behavior does not result in an actual bug.

See also:

- https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
- https://www.ietf.org/archive/id/draft-duke-tsvwg-udp-ecn-01.html
- https://docs.rs/windows-sys/latest/windows_sys/Win32/Networking/WinSock/constant.IP_RECVECN.html
- https://docs.rs/windows-sys/latest/windows_sys/Win32/Networking/WinSock/constant.IP_ECN.html
2025-01-06 19:56:11 +00:00
Max Inden c32e2e2089 fix(udp/windows): set socket option IPV6_RECVECN
On Windows, to enable ECN reporting, one sets the `IPV6_RECVECN` socket option.
The Windows IP stack will then report ECN markings via the `IPV6_ECN` message
type.

Previously `quinn-udp` would use `IPV6_ECN` for both. With this commit
`IPV6_RECVECN` is used to set the socket option and `IPV6_ECN` is used to read
the option.

Given that both constants evaluate to the same value (i.e. `50`) the previous
behavior does not result in an actual bug.

See also:

- https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options
- https://www.ietf.org/archive/id/draft-duke-tsvwg-udp-ecn-01.html
- https://docs.rs/windows-sys/latest/windows_sys/Win32/Networking/WinSock/constant.IPV6_RECVECN.html
- https://docs.rs/windows-sys/latest/windows_sys/Win32/Networking/WinSock/constant.IPV6_ECN.html
2025-01-05 21:39:05 +00:00
Asmir Avdicevic fd9f5c1024 chore: add project tracking (#24) 2025-01-03 14:10:42 +01:00
Phoenix Kahlo f5b1ec7dd9 proto: Replace calls to Duration::new
Replaces them with more modern and appropriate constructors or
constants.
2024-12-26 22:07:30 +00:00
Benjamin Saunders 23b18f2882 proto: remove redundant cursors 2024-12-26 21:04:18 +00:00
Dirkjan Ochtman 3f0afaeaf4 Add gretchenfrage as a maintainer 2024-12-26 03:55:39 +00:00
Phoenix Kahlo ffbd15f087 proto: Use match for grease with reserved version
Reduces LOC.
2024-12-25 20:14:03 +00:00