summaryrefslogtreecommitdiff
path: root/crates/tor-chanmgr/src
Commit message (Collapse)AuthorAgeFilesLines
* ChanMgr: errors: attribute errors to correct address.Nick Mathewson2022-07-061-3/+7
| | | | | | Even when keys are relevant, we still don't want to attribute errors to a set of addresses when we have a single address that we're connected with.
* ChanMgr: Add more contextual info to error types.Nick Mathewson2022-07-063-25/+40
| | | | | | Now each type has a peer. In some cases this peer is just an address, whereas in others (where key is relevant or address isn't yet narrowed down) it's a full OwnedChanTarget.
* clippy: Consolidate many lints in maint/add_warningIan Jackson2022-06-241-0/+3
| | | | | | 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.
* maint/add_warning: Add two lints via add_warning as a test caseIan Jackson2022-06-241-0/+2
|
* maint/add_warning: Add ability maintain test lint blocksIan Jackson2022-06-241-0/+3
|
* Run maint/add_warning crates/*/src/{lib,main}.rsIan Jackson2022-06-231-0/+3
| | | | Update all lint blocks
* Merge branch 'display_source_cleanup' into 'main'eta2022-06-211-2/+2
|\ | | | | | | | | Do not include error source() in display() format. See merge request tpo/core/arti!598
| * Do not include error source() in display() format.Nick Mathewson2022-06-211-2/+2
| | | | | | | | | | | | | | | | | | According to doc/Errors.md, and in keeping with current best practices, we should not include display an error's `source()` as part of that error's display method. Instead, we should let the caller decide to call source() and display that error in turn. Part of #323.
* | tor-chanmgr: Change to use unwrap_voidIan Jackson2022-06-211-8/+4
| | | | | | | | | | As per discussion in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813573
* | channel padding: Rename ChannelsParams from ChannelsConfigIan Jackson2022-06-213-39/+39
| | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2814276 Change names and comments and docs everywhere.
* | channel padding: chanmgr: Clarify a commentIan Jackson2022-06-211-3/+3
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/586#note_2813574
* | channel padding: Use IntegerMilliseconds in netdirIan Jackson2022-06-211-12/+10
| |
* | channel padding: Use IntegerMilliseconds in padding::ParametersIan Jackson2022-06-211-10/+15
| |
* | channel padding parameters update: Drop a redundant cloneIan Jackson2022-06-211-1/+1
| |
* | Fix typoseta2022-06-211-2/+2
| |
* | channel padding: Test timeout updatesIan Jackson2022-06-211-0/+49
| |
* | tor-chanmgr tests: Add config_update tracking to FakeChannelIan Jackson2022-06-211-1/+7
| |
* | channel padding: Honour NetDir for timeoutsIan Jackson2022-06-211-3/+47
| | | | | | | | But padding is still not enabled by default.
* | channel padding: Plumb settings from chanmgrIan Jackson2022-06-214-14/+185
| |
* | chanmgr: inner (map): Reorganise to prepare for having more stateIan Jackson2022-06-211-14/+27
| | | | | | | | | | | | The main copy of the (global) configuration for the client's channels is going to have to live here, inside this mutex. So this really needs to become a struct with names fields.
* | tor-chanmgr: tests: Have unwrap_open return a (mut) referenceIan Jackson2022-06-211-2/+2
|/ | | | | This avoids confusing bugs where you try to modify the result and nothing happens!
* Plumb a SleepProvider into the channel reactorIan Jackson2022-06-081-1/+4
| | | | | The channel reactor is going to want to be able to sleep so that it can do padding, so it needs a SleepProvider.
* lints: Add let_unit_value allow to all cratesIan Jackson2022-05-311-0/+1
| | | | | From running add_warning, with manual picking of the right hunks/lines.
* lints: Add lint block delimiters to every crateIan Jackson2022-05-311-0/+2
| | | | | | This was the result of: maint/add_warning crates/*/src/{lib,main}.rs and then manually curating the results.
* chanmgr: expose whether we are failing because of expired certs.Nick Mathewson2022-04-122-20/+87
|
* ChanMgr: Return provenance information from get_or_launchNick Mathewson2022-04-072-14/+31
| | | | | | We need this since we want to report certain conditions only when they happen on a new channel, not if we observe them on a preexisting channel.
* chanmgr: bubble ClockSkew up through the Error object.Nick Mathewson2022-04-073-9/+58
| | | | | | | | 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.
* Merge branch 'main' into 'retriable'Nick Mathewson2022-04-052-3/+98
|\ | | | | | | # Conflicts: # doc/semver_status.md
| * chanmgr: tests for ConnStatus::usableNick Mathewson2022-04-021-0/+5
| |
| * chanmgr: add a test for AbstractChannel::duration_unusedNick Mathewson2022-04-021-1/+9
| |
| * chanmgr: add tests for connect_one.Nick Mathewson2022-04-021-2/+84
| |
* | chanmgr: implement HasRetryTime.Nick Mathewson2022-04-041-0/+31
|/
* Make daemon tasks self-contained; introduce NetDirProvidereta2022-03-301-0/+41
| | | | | | | | | | | | | | | The various background daemon tasks that `arti-client` used to spawn are now handled inside their respective crates instead, with functions provided to spawn them that return `TaskHandle`s. This required introducing a new trait, `NetDirProvider`, which steals some functionality from the `DirProvider` trait to enable `tor-circmgr` to depend on it (`tor-circmgr` is a dependency of `tor-dirmgr`, so it can't depend on `DirProvider` directly). While we're at it, we also make some of the tasks wait for events from the `NetDirProvider` instead of sleeping, slightly increasing efficiency.
* tor-proto: add a backend to detect reported clock skew.Nick Mathewson2022-03-231-1/+4
| | | | | | | | | | | | | | | | 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.
* Merge branch 'ticket_383' into 'main'Ian Jackson2022-03-091-5/+5
|\ | | | | | | | | | | | | tor-chanmgr: Do not allocate an Internal error unless we mean it. Closes #383 See merge request tpo/core/arti!394
| * tor-chanmgr: Do not allocate an Internal error unless we mean it.Nick Mathewson2022-03-081-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | Previously we'd allocate an error as a place-holder here, but it's not a great idea to do that with a `Bug`: each `Bug` stores a whole stack trace, which uses a whole pile of allocations to construct. Now we keep an `Option<Error>` instead. Found while heap profiling. Closes #383.
* | Merge branch 'moderately-enthused-eyeballs' into 'main'eta2022-03-072-21/+84
|\ \ | |/ |/| | | | | Implement a basic form of RFC 8305 ("happy eyeballs") for channels See merge request tpo/core/arti!382
| * Implement a basic form of RFC 8305 ("happy eyeballs") for channelseta2022-03-072-21/+84
| | | | | | | | | | | | | | | | | | | | | | | | This makes Arti usable in IPv6-only environments (arti#92) by letting us attempt multiple connections to a given relay using all of its addresses instead of just using the first (probably IPv4) one, using the strategy from RFC 8305 § 5. This isn't a complete implementation of Happy Eyeballs; ideally, we'd sort the address list before doing concurrent connections. However, it works (and has been tested inside an IPv6-only container inside eta's network :p)
* | Move skip_fmt into tor-basic-utilsIan Jackson2022-03-041-1/+1
| | | | | | | | | | | | | | Code motion and the minimal mechanical changes. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/375#note_2783078
* | Replace manual Debug impl with educe in tor-chanmgrIan Jackson2022-03-021-7/+5
|/
* Merge branch 'clippy-allow-arc-clone' into 'main'Nick Mathewson2022-03-011-1/+0
|\ | | | | | | | | Disable clippy::clone_on_ref_ptr See merge request tpo/core/arti!352
| * Disable clippy::clone_on_ref_ptrIan Jackson2022-02-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lint is IMO inherently ill-conceived. I have looked for the reasons why this might be thought to be a good idea and there were basically two (and they are sort of contradictory): I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact that only the pointer is being cloned, not the underlying data." This is the wording from https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr It is a bit terse; we are left to infer why it is a bad idea to obscure this fact. It seems to me that if it is bad to obscure some fact, that must be because the fact is a hazard. But why would it be a hazard to not copy the underlying data ? In other languages, faliing to copy the underlying data is a serious correctness hazard. There is a whose class of bugs where things were not copied, and then mutated and/or reused in multiple places in ways that were not what the programmer intended. In my experience, this is a very common bug when writing Python and Javascript. I'm told it's common in golang too. But in Rust this bug is much much harder to write. The data inside an Arc is immutable. To have this bug you'd have use interior mutability - ie mess around with Mutex or RefCell. That provides a good barrier to these kind of accidents. II. "The reason for writing Rc::clone and Arc::clone [is] to make it clear that only the pointer is being cloned, as opposed to the underlying data. The former is always fast, while the latter can be very expensive depending on what is being cloned." This is the reasoning found here https://github.com/rust-lang/rust-clippy/issues/2048 This is saying that *not* using Arc::clone is hazardous. Specifically, that a deep clone is a performance hazard. But for this argument, the lint is precisely backwards. It's linting the "good" case and asking for it to be written in a more explicit way; while the supposedly bad case can be written conveniently. Also, many objects (in our codebase, and in all the libraries we use) that are Clone are in fact simply handles. They contain Arc(s) (or similar) and are cheap to clone. Indeed, that is the usual case. It does not make sense to distinguish in the syntax we use to clone such a handle, whether the handle is a transparent Arc, or an opaque struct containing one or more other handles. Forcing Arc::clone to be written as such makes for code churn when a type is changed from Arc<Something> to Something: Clone, or vice versa.
* | tor-proto: Split IoErr based on when it occursNick Mathewson2022-02-231-1/+1
|/ | | | | | | We want to distinguish handshake failures from errors later on in the channel's lifetime. Closes #359.
* Rename TorConnectionFailed to TorAccessFailedNick Mathewson2022-02-221-2/+2
|
* tor-chanmgr: use Bug types.Nick Mathewson2022-02-164-16/+24
|
* Implement HasKind for tor-chanmgr::ErrorNick Mathewson2022-02-161-2/+6
| | | | (There will be a folowup to work on internal errors here.)
* Change deny(clippy::all) to warn(clippy::all).Nick Mathewson2022-02-141-1/+1
| | | | Closes #338.
* Fix typosDimitris Apostolou2022-02-101-1/+1
|
* Merge branch 'error-improvements' into 'main'eta2022-02-082-12/+23
|\ | | | | | | | | Hopefully uncontroversial improvements to new Error code See merge request tpo/core/arti!291
| * Make SpawnError wrappers contain a 'spawning' stringNick Mathewson2022-02-042-12/+23
| | | | | | | | | | (By our convention, these errors should say what we were trying to spawn when the error occurred.)