summaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src
Commit message (Collapse)AuthorAgeFilesLines
* Improve some documentation linksNick Mathewson2021-10-292-6/+6
| | | | | | | | | Instead of putting a fully qualified name in the text, in most cases we should just use the short name of the type or function we're referring to. In other words, instead of saying [`crate::module::Foo`], we should typically say [`Foo`](crate::module::Foo).
* Update our disclaimers and limitations sections.Nick Mathewson2021-10-271-0/+1
|
* Add Futureproof<T> wrapper type, use for GuardDisabled enumeta2021-10-271-6/+4
| | | | | | | | | | | The Futureproof<T> type lets you serialize and deserialize types whose representations might change (most useful for enums that might grow additional variants). It uses #[serde(untagged)] to accomplish this. This gets used in order to make the `disabled` field of `Guard` more robust against future guard disablement reasons being added. A test was also added to verify correct behaviour of the new type.
* Add #[serde(flatten)] HashMap fields to serializable objectseta2021-10-272-4/+20
| | | | | | | | | | As per arti#175, we'd like to be able to handle newer Arti versions storing additional state in the persisted state files, without dropping this data on the floor when we write out changes to these files. Use the #[serde(flatten)] mechanism to achieve this, by adding catch-all HashMap<String, JsonValue> fields to all structs that are at risk of this happening to them.
* Avoid a strange borrow syntax in tor_guardmgr::sampleNick Mathewson2021-10-261-3/+3
| | | | I'm not sure what I was thinking here.
* Do not blame a guard for failures on non-random circuits.Nick Mathewson2021-10-261-3/+30
| | | | | | | | | We must not apply our new path-bias behavior (where we blame a guard if it gives us too many indeterminate circuit failures) if the path was not chosen at random. If too many random paths fail, we know that's suspicious, since the other relays are a random sample. But if a bunch of user-provided paths fail, that could simply be because the user's chosen exit is down.
* Implement a "lightweight" form of pathbias detection.Nick Mathewson2021-10-263-5/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | We now track, for every guard: the total number of successful circuits we've built through it, along with the total number of "indeterminate" circuits. Recall that a circuit's status is "indeterminate" if it has failed for a reason that _might_ be the guard's fault, or might not be the guard's fault. For example, if extending to the second hop of the circuit fails, we have no way to know whether the guard deliberately refused to connect there, or whether the second hop is just offline. But we don't want to forgive all indeterminate circuit failures: if we did, then a malicious guard could simply reject any second hops that it didn't like, thereby filtering the client into a chosen set of circuits. As a stopgap solution, this patch now makes guards become permanently disabled if the fraction of their circuit failures becomes too high. See also general-purpose path bias selection (arti#65), and Mike's idea for changing the guard reachability definition (torspec#67). This patch doesn't do either of those. Closes #185.
* guardmgr: Don't use guards that are marked as unlisted.Nick Mathewson2021-10-252-7/+22
| | | | Closes #202.
* Merge branch 'share_state'Nick Mathewson2021-10-213-11/+62
|\
| * Implement the guard side of shared state directories.Nick Mathewson2021-10-213-2/+41
| |
| * Finish the timeout-inference side of shared state.Nick Mathewson2021-10-201-2/+19
| |
| * Replace the return type of StorageMgr::try_lock with a tristateNick Mathewson2021-10-201-1/+1
| | | | | | | | | | It's useful to know now only if we now have the lock, but also if we just got it for the first time.
| * Initial work on periodically reloading state.Nick Mathewson2021-10-191-11/+6
| | | | | | | | | | We can use this in the case where we don't get the lock on the state file, because another process is running.
* | Fix most warnings from nightly.Nick Mathewson2021-10-192-0/+2
|/ | | | (One represents code that I forgot to write.)
* Remove Guard::get_relay(); use Guard::guard_id().get_relay().Nick Mathewson2021-10-191-12/+4
| | | | | | | | | The `get_relay` function was confusing, since it would return None if the relay was present, but wasn't actually a guard. We only used it in one place, and in that one place we used it wrong, leading to a panic bug. Fixes #193.
* Use better reporting for guard status.Nick Mathewson2021-10-132-2/+8
| | | | | | | | | | | | | The previous code would report all failures to build a circuit as failures of the guard. But of course that's not right: If we fail to extend to the second or third hop, that might or might not be the guard's fault. Now we use the "pending status" feature of the GuardMonitor type so that an early failure is attributed to the guard, but a later failure is attributed as "Indeterminate". Only a complete circuit is called a success. We use a new "GuardStatusHandle" type here so that we can report the status early if there is a timeout.
* Rename GuardStatusMsg, make it public, add an `Indeterminate` case.Nick Mathewson2021-10-133-26/+43
|
* Actually select guards for directory circuits.Nick Mathewson2021-10-131-1/+2
|
* Make the guard selection function return a more useful type.Nick Mathewson2021-10-113-4/+56
|
* Change the GuardMgr APIs to no longer be async.Nick Mathewson2021-10-101-32/+18
|
* Use an mpsc::unbounded() channel in GuardMgr.Nick Mathewson2021-10-102-29/+22
| | | | | | | | | | | | The advantage here is that we no longer have to use a futures-aware Mutex, or a blocking send operation, and therefore can simplify a bunch of the GuardMgr APIs to no longer be async. That'll avoid having to propagate the asyncness up the stack. The disadvantage is that unbounded channels are just that: nothing in the channel prevents us from overfilling it. Fortunately, the process that consumes from the channel shouldn't block much, and the channel only gets filled when we're planning a circuit path.
* enable checked_conversions lint.Nick Mathewson2021-10-091-0/+1
|
* Normalize tor-guardmgr warningsNick Mathewson2021-10-091-6/+6
|
* Note a possible heisenbug in a unit test.Nick Mathewson2021-10-081-0/+6
|
* Add a few tracing calls to tor-guardmgr.Nick Mathewson2021-10-083-17/+74
|
* Resolve small issues and XXXX/TODO comments in GuardMgr.Nick Mathewson2021-10-075-48/+63
| | | | | By the time I merge this, most of the comments should have tickets to go with them.
* Tests for top-level GuardMgr.Nick Mathewson2021-10-074-23/+202
| | | | | | | Also, refactor our message handling to be more like the tor_proto reactors. The previous code had a bug where, once the stream of events was exhausted, we wouldn't actually get any more notifications.
* Tests for tor_guardmgr::sample.Nick Mathewson2021-10-071-1/+330
|
* Initial tests for tor_guardmgr::guardNick Mathewson2021-10-071-0/+295
|
* Implement persistent state for guard mgrNick Mathewson2021-10-071-9/+25
|
* Initial backend implementation for guard node manager.Nick Mathewson2021-10-077-0/+2468
There are some missing parts here (like persistence and tests) and some incorrect parts (I am 90% sure that the "exploratory circuit" flag is bogus). Also it is not integrated with the circuit manager code.