aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src/sample.rs
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'ticket_176_v2' into 'main'Nick Mathewson2022-01-111-13/+8
|\ | | | | | | | | | | | | guardmgr: Use a better persistent data format Closes #176 See merge request tpo/core/arti!233
| * Remove now-unused GuardSet::new().Nick Mathewson2022-01-111-14/+8
| |
| * guardmgr: Use a better persistent data formatNick Mathewson2022-01-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we stored only one guard sample, in a state file called "default_guards". That's not future-proof, since we want to have multiple samples in the future. (`guard-spec.txt` specifies separate samples for highly restrictive filters, and for bridge usage.) This patch changes our behavior so that we can store multiple samples in a new "guards" file. I had thought about automatically migrating from the previous file format and location, but I don't think that's necessary given our current (lack of) stability guarantees. Closes #176.
* | guardmgr::..::sample_test: Fix intermittent failure.Nick Mathewson2022-01-111-3/+37
|/ | | | | | | | | | | | | | This test should only fail very rarely (around 1/2.4e8) when guards are chosen from a list of 20 with uniform probability. But that wasn't what we were doing on the mock test network: we were choosing from a list of 10 viable guards, with nonuniform probability. As a fix, we change the test network probabilities so that the guards _are_ chosen with a uniform probability for this test, and we use a modified version of the test network where there are indeed 20 Guard-flagged relays with the required DirCache=2 protocol. Closes #276.
* Tests for new guardmgr functionality.Nick Mathewson2022-01-061-0/+32
|
* Add API to check if primary MDs are missing.Nick Mathewson2022-01-061-0/+12
| | | | | | | We need this information to know if it's okay to migrate to a new NetDir, or if we need to download more information first. Part of #178.
* Make TlsConnector wrap TCP connections, not create its owneta2021-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | `tor-rtcompat`'s `TlsConnector` trait previously included a method to create a TLS-over-TCP connection, which implied creating a TCP stream inside that method. This commit changes that, and makes the function wrap a TCP stream, as returned from the runtime's `TcpProvider` trait implementation, instead. This means you can actually override `TcpProvider` and have it apply to *all* connections Arti makes, which is useful for issues like arti#235 and other cases where you want to have a custom TCP stream implementation. This required updating the mock TCP/TLS types in `tor-rtmock` slightly; due to the change in API, we now store whether a `LocalStream` should actually be a TLS stream inside the stream itself, and check this property on reads/writes in order to detect misuse. The fake TLS wrapper checks this property and removes it in order to "wrap" the stream, making reads and writes work again.
* add semicolons if nothing returnedDaniel Eades2021-11-251-1/+1
|
* deglob some enums, use concise iteration syntaxDaniel Eades2021-11-251-6/+6
|
* tor-guardmgr: Add tests for a few functions.Nick Mathewson2021-11-021-0/+39
|
* Mark primary guards as retriable when we come back online.Nick Mathewson2021-11-021-0/+9
| | | | | | | | | | | | We define "coming back online" as happening when a guard attempt succeeds, if that attempt that was launched when we seemed to be offline. We define "seeming to be offline" as having all of our primary guards marked unreachable, and having received no incoming network traffic in a while. Closes #216.
* Add #[serde(flatten)] HashMap fields to serializable objectseta2021-10-271-2/+12
| | | | | | | | | | 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.
* Implement a "lightweight" form of pathbias detection.Nick Mathewson2021-10-261-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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-251-7/+17
| | | | Closes #202.
* Implement the guard side of shared state directories.Nick Mathewson2021-10-211-0/+9
|
* Make the guard selection function return a more useful type.Nick Mathewson2021-10-111-0/+5
|
* Add a few tracing calls to tor-guardmgr.Nick Mathewson2021-10-081-7/+20
|
* Resolve small issues and XXXX/TODO comments in GuardMgr.Nick Mathewson2021-10-071-12/+17
| | | | | By the time I merge this, most of the comments should have tickets to go with them.
* Tests for tor_guardmgr::sample.Nick Mathewson2021-10-071-1/+330
|
* Initial backend implementation for guard node manager.Nick Mathewson2021-10-071-0/+690
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.