summaryrefslogtreecommitdiff
path: root/crates/tor-proto/src/channel
Commit message (Collapse)AuthorAgeFilesLines
* change usage of PublicKey to Ed25519 in tor-certtrinity-1686a2022-07-231-5/+3
| | | | and propagate to other affected crates
* change check_key to take a Option<&_> instead of &Option<_>trinity-1686a2022-07-231-2/+2
|
* tor-cell: Make encoding method signatures fallible.Nick Mathewson2022-07-111-1/+5
|
* Merge branch 'clippy' into 'main'Ian Jackson2022-06-241-3/+9
|\ | | | | | | | | Fix clippy nightly again See merge request tpo/core/arti!603
| * clippy: Consolidate many lints in maint/add_warningIan Jackson2022-06-241-3/+9
| | | | | | | | | | | | Found these by disabling the nightly dbg macro special case. Now, we have a mechanism for globally adding suppressions to tests, we can use that instead.
* | tor-proto: split and elaborate tor_bytes::Error instancesNick Mathewson2022-06-231-5/+14
| | | | | | | | | | | | | | | | | | Some of these were for decoding particular objects (we now say what kind of objects), and some were unrelated tor_cert errors that for some reason we had shoved into a tor_bytes::Error. There is now a separate tor_cert::CertError type, independent from tor_cert's use of `tor_bytes::Error` for parsing errors.
* | tor-proto: Split CellErr based on activity.Nick Mathewson2022-06-233-7/+15
| | | | | | | | | | | | Failing to encode is fundamentally different from failing to decode. We now treat those separately, and describe _what_ we failed to encode or decode.
* | tor-proto: clean up error names and messagesNick Mathewson2022-06-233-26/+26
|/ | | | | This avoids adding additional information for now; that will come on the next commits.
* channel padding: Rename ChannelsParams from ChannelsConfig (rustfmt)Ian Jackson2022-06-211-1/+1
| | | | Consequential ordering changes.
* channel padding: Rename ChannelsParams from ChannelsConfigIan Jackson2022-06-212-53/+53
| | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2814276 Change names and comments and docs everywhere.
* tor-proto: err: Provide ChannelClosed as a separate unit errorIan Jackson2022-06-211-2/+2
|
* channel padding: Use IntegerMilliseconds in padding::ParametersIan Jackson2022-06-211-10/+11
|
* Fix docs for `CtrlMsg::ConfigUpdate`Ian Jackson2022-06-211-5/+2
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813565
* Fix typoseta2022-06-211-1/+1
|
* channel padding: Introduce ChannelsConfig and reconfigure facilityIan Jackson2022-06-213-2/+226
| | | | Nothing geenrates config updates yet.
* channel padding timer: Support reconfigurationIan Jackson2022-06-211-4/+15
| | | | Nothing calls this yet.
* channel padding timer: Allow creation without providing parameters yetIan Jackson2022-06-211-14/+30
| | | | It turns out that we are going to want this.
* channel padding: Test creation in disabled stateIan Jackson2022-06-211-0/+12
| | | | | We're about to split the main new() function off so write a separate test for new_disabled().
* channel padding: Make Parameters a pub struct with builderIan Jackson2022-06-211-2/+13
| | | | chanmgr is going to want to make one of these from a NetDir.
* Merge branch 'config-fix2' into 'main'Nick Mathewson2022-06-161-0/+1
|\ | | | | | | | | Use impl_standard_builder more and remove manual Default/builder impls See merge request tpo/core/arti!594
| * tor-proto: channel: Tell clippy it's ok to print in testsIan Jackson2022-06-161-0/+1
| |
* | Permit eprintln in channel-padding test.Nick Mathewson2022-06-151-0/+1
|/ | | | | There is not, apparently, an eprintln equivalent for allow-dbg-in-tests.
* channel padding timer: Explain why next() in select_biased!Ian Jackson2022-06-091-0/+7
|
* channel padding timer: document state invariantsIan Jackson2022-06-091-2/+24
| | | | There aren't very many.
* Fix more typos in comments, from a spellcheckerIan Jackson2022-06-091-6/+6
|
* Fix typo in commentNick Mathewson2022-06-091-1/+1
|
* Fix erroneous commentNick Mathewson2022-06-091-1/+1
|
* Fix typos in commentsNick Mathewson2022-06-091-3/+3
|
* tor-proto: padding: Test padding timer distributionIan Jackson2022-06-081-0/+123
|
* tor-proto: channel: Use padding::TimerIan Jackson2022-06-082-11/+30
|
* tor-proto: channel: Provide padding::TimerIan Jackson2022-06-081-0/+405
|
* Merge branch 'sleep' into 'main'Ian Jackson2022-06-082-51/+102
|\ | | | | | | | | Plumb a SleepProvider (now Clone + ....) into Channel See merge request tpo/core/arti!569
| * Plumb a SleepProvider into the channel reactorIan Jackson2022-06-082-51/+102
| | | | | | | | | | The channel reactor is going to want to be able to sleep so that it can do padding, so it needs a SleepProvider.
* | Use testing_rng() in tests throughout our crates.Nick Mathewson2022-06-021-1/+2
|/ | | | | | This only affects uses of thread_rng(), and affects them all more or less indiscriminately. One test does not work with ARTI_TEST_PRNG=deterministic; the next commit will fix it.
* prepare_send_from: clippy: Replace some or_else with orIan Jackson2022-05-231-2/+2
|
* channel: Provide and use Sink::prepare_send_fromIan Jackson2022-05-231-75/+25
| | | | | | | | | | | | | | | | | | | | This is a general-purpose implementation of the ad-hoc approach currently taken in (eg) crates/tor-proto/src/channel/reactor.rs, with an API intended to defned against the more obvious mistakes. This allows us to separate the two concerns: the channel reactor can focus on handling channel cells and control messages and is over 2.5x shorter. The complexity of the manual sink implementation, and the machinery needed to avoid having to suspend while holding an item, are dealt with separately. That separate implemenation now has proper documentation. (Tests are in the nest commit to avoid this one being even more unwieldy.) We use `extend` to define this as an extension trait. A competitor is `ext` but in my personal projects I have found `extend` slightly better.
* clippy: Change a binding to (), and allow clippy::let_unit_valueIan Jackson2022-05-111-1/+1
| | | | | | | | | | | | | | | | | The type of ret.map_err(codec_err_to_chan)? is (). ISTM that writing `let () = ` makes it clear that there is nothing there, but the lint forbids this. This lint is warn by default and trips here for me on current nightly. It seems wrong to me. We should be able to make it clear to the reader that there is nothing here - note how this differs from the lines below where Ready contains msg. A let () binding is a good way to do that. I think the lint allow ought to be added everywhere, but that doesn't seem easy right now - see this issue about maint/add_warning: https://gitlab.torproject.org/tpo/core/arti/-/issues/469
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* handshake.rs: Document the time for clock skew authentication.Nick Mathewson2022-04-111-3/+25
|
* chanmgr: bubble ClockSkew up through the Error object.Nick Mathewson2022-04-071-1/+1
| | | | | | | | Fortunately, we don't need a separate type here: authenticated clock skew can only come attached to a `tor_proto::Error`. We also remove skew from `tor_proto::Error::HandshakeCertsExpired`, since it would now be redundant.
* Channel: Expose our view of whether the clock is skewed, and the ageNick Mathewson2022-04-072-0/+10
| | | | | | | | of a channel. At first I wanted to have this information not be a part of channels at all, but it is a fairly tiny amount of data, and the alternatives are pretty crufty.
* Merge branch 'netinfo-clock-skew' into 'main'Nick Mathewson2022-03-231-20/+104
|\ | | | | | | | | tor-proto: add the ability to learn clock skew from NETINFO cells See merge request tpo/core/arti!410
| * tor-proto: better errors when handshake fails due to untimely certsNick Mathewson2022-03-231-10/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We now check the handshake certificates unconditionally, and only report them as _expired_ as a last resort. (Rationale: if somebody is presenting the wrong identity from a year ago, it is more interesting that they are presenting the wrong ID than it is that they are doing so with an expired cert. We also now report a different error if the certificate is expired, but its expiration is within the range of reported clock skew. (Rationale: it's helpful to distinguish this case, so that we can blame the failure on possible clock skew rather than definitely attributing it to a misbehaving relay.) Part of #405.
| * tor-proto: add a backend to detect reported clock skew.Nick Mathewson2022-03-231-10/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NETINFO cells, which are sent in every handshake, may contain timestamps. This patch adds an accessor for the timestamp in the Netinfo messages, and teaches the tor-proto code how to compute the minimum clock skew in the code. The computation isn't terribly precise, but it doesn't need to be: Tor should work fine if your clock is accurate to within a few hours. This patch also notes a Y2038 problem in the protocol: see torspec#80. Part of #405.
* | tor-proto: Remember peer information in circuit and channelNick Mathewson2022-03-172-7/+11
|/ | | | | | | | | Each channel now remembers an OwnedChanTarget. Each circuit now remembers a vector of OwnedChanTarget to represent the path that it was constructed for. Part of #415.
* remove usage of dbg!(..)trinity-1686a2022-02-281-1/+0
| | | | it's making rust-nightly job fail
* proto: Refactor conversion from CodecError to ErrorNick Mathewson2022-02-243-32/+37
| | | | | Remove default conversion; instead use a specific conversion in each of the two modules that need to do it.
* tor-proto: refactor handshake protocol errors to a different typeNick Mathewson2022-02-231-49/+68
| | | | | | | | This helps the user distinguish between protocol violations that happen when connecting to the tor network from those that happen while connected. Closes #358.
* tor-proto: Rename BadHandshake to BadCircHandshakeNick Mathewson2022-02-231-1/+1
| | | | (We'll have a BadChanHandshake soon.)
* tor-proto: Split IoErr based on when it occursNick Mathewson2022-02-232-7/+21
| | | | | | | We want to distinguish handshake failures from errors later on in the channel's lifetime. Closes #359.