summaryrefslogtreecommitdiff
path: root/crates/tor-guardmgr/src/vanguards.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-guardmgr: Make remove_expired return the number of expired vanguards.Gabriela Moldovan2024-04-301-3/+2
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2109#note_3024672
* tor-guardmgr: Prevent misleading logs when not rotating vanguards.Gabriela Moldovan2024-04-291-2/+5
| | | | | `rotate_expired()` now only logs that it is rotating the vanguards if some existing vanguards have actually expired.
* tor-guardmgr: Make a vanguard log message more accurate.Gabriela Moldovan2024-04-291-1/+1
| | | | | We flush every time the vanguards may have changed, but we don't know for sure if they did.
* tor-guardmgr: Make the VanguardMgr tests pass again.Gabriela Moldovan2024-04-291-14/+29
| | | | | The tests need to be updated now that the `VanguardMode` is read from the config rather than the consensus.
* tor-guardmgr: Temporarily reintroduce VanguardConfig.Gabriela Moldovan2024-04-291-35/+66
| | | | | | | | | | | | | | As discussed on #tor-dev, I'm reintroducing `VanguardConfig` for now. The `VanguardConfig` specifies what mode (full/lite/disabled) the `VanguardMgr` should run in. We currently don't have a separate modes for HS clients and HS services. We shouldn't actually *need* a `VanguardConfig` at all, so this is just a (hopefully!) short- or medium-term fix until we sort out #1382 (which might involve making breaking changes to our `reconfigure()` APIs). Closes #1272
* tor-guardmgr: Remove unnecessary clippy allows.Gabriela Moldovan2024-04-291-4/+0
| | | | None of these should be unused anymore.
* tor-guardmgr: Remove unnecessary VanguardSetsTrackedMut contraption (fmt).Gabriela Moldovan2024-04-221-1/+2
|
* tor-guardmgr: Remove unnecessary VanguardSetsTrackedMut contraption.Gabriela Moldovan2024-04-221-14/+9
| | | | | | | | The VanguardMgr now unconditionally flushes the vanguard sets to disk each time there's a consensus change, and every time a vanguard expires. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2090#note_3021013
* tor-guardmgr: Remove pick_{l2,l3}_relay, add l2(), l3() accessors (fmt).Gabriela Moldovan2024-04-221-20/+19
|
* tor-guardmgr: Remove pick_{l2,l3}_relay, add l2(), l3() accessors.Gabriela Moldovan2024-04-221-2/+4
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2090#note_3021016
* tor-guardmgr: Make vanguard logs begin with an uppercase letter for consistency.Gabriela Moldovan2024-04-221-3/+3
| | | | | Our log messages begin with an uppercase letter in the rest of the code base.
* tor-guardmgr: Add logging around vanguard rotation.Gabriela Moldovan2024-04-221-0/+2
|
* tor-guardmgr: Add a TODO about rethinking vanguard flushing.Gabriela Moldovan2024-04-221-0/+14
|
* tor-guardmgr: Rename VanguardMgr::handle_netdir_update for clarity (fmt).Gabriela Moldovan2024-04-221-2/+1
|
* tor-guardmgr: Rename VanguardMgr::handle_netdir_update for clarity.Gabriela Moldovan2024-04-221-9/+6
|
* tor-guardmgr: Test that vanguards are written to persistent storage.Gabriela Moldovan2024-04-221-1/+137
|
* tor-guardmgr: Fix vanguard doc links.Gabriela Moldovan2024-04-221-4/+4
| | | | The referenced types are no longer available in `vanguards.rs`.
* tor-guardmgr: Select an L3 vanguard in a vanguard test.Gabriela Moldovan2024-04-221-4/+3
|
* tor-guardmgr: Allow running VanguardMgr in "service mode" in the tests.Gabriela Moldovan2024-04-221-7/+7
| | | | We will soon use this to test full vanguards.
* tor-guardmgr: Load the vanguards from disk on startup.Gabriela Moldovan2024-04-221-7/+26
| | | | | | The `VanguardMgr` reads the vanguards from the vanguards state file, whether full vanguards are enabled or not. It only persists the vanguard sets to storage if full vanguards are in use.
* tor-guardmgr: Flush the vanguard changes to disk (fmt).Gabriela Moldovan2024-04-221-1/+2
|
* tor-guardmgr: Flush the vanguard changes to disk.Gabriela Moldovan2024-04-221-3/+8
|
* tor-guardmgr: Implement VanguardMgr::flush_to_storage.Gabriela Moldovan2024-04-221-10/+15
|
* tor-guardmgr: Fix vanguard expiration test.Gabriela Moldovan2024-04-221-1/+18
| | | | | | | | | | | | | | | | Since `rotate_expired()` (previously `remove_expired()`) now also replenishes the vanguard sets, we can't use `advance_until_stalled()` anymore, because `run_once()` is never be stalled in the tests (`next_to_expire` is never `None`, so `sleep_fut` is never `future::pending()`: ``` warning: MockRuntime advance_* looped >1000 (next sleep: 877560507ms) ``` Previously, `next_to_expire` was computed *before* replenishing the vanguard sets, which is why the tests could use `advance_until_stalled()`.
* tor-guardmgr: Don't try to replenish the sets unless some vanguards expired.Gabriela Moldovan2024-04-221-23/+18
| | | | | This addresses a TODO about not calling `handle_netdir_update` unconditionally each time `VanguardMgr::run_once()` runs.
* tor-guardmgr: Move vanguard set replenishing logic to VanguardSetsTrackedMut.Gabriela Moldovan2024-04-221-212/+100
| | | | | | A lot of this is code motion: the code added to `VanguardSetsTrackedMut` was copied from the `VanguardMgr` impl, so I recommend reviewing this with `git diff --color-moved=zebra`.
* tor-guardmgr: Add VanguardMgrError variant for tor-persist errors.Gabriela Moldovan2024-04-221-0/+5
|
* tor-guardmgr: Create storage handle for storing vanguards.Gabriela Moldovan2024-04-221-3/+11
|
* tor-guardmgr: Add a TODO about a call that needs to be relocated.Gabriela Moldovan2024-04-221-0/+10
| | | | This TODO is fixed later in the branch.
* tor-guardmgr: Use RelayUsage::vanguard in the VanguardMgr.Gabriela Moldovan2024-04-221-2/+1
| | | | Closes #1364
* Merge branch 'vanguards-cleanup' into 'main'Alexander Færøy2024-04-151-3/+3
|\ | | | | | | | | tor-guardmgr: Minor vanguard-related cleanups See merge request tpo/core/arti!2088
| * tor-guardmgr: Remove unnecessary mutable reference.Gabriela Moldovan2024-04-151-3/+3
| |
* | vanguards: Fix another doc refIan Jackson2024-04-151-1/+1
| | | | | | | | This was a typo.
* | vanguards: Fix a doc refIan Jackson2024-04-151-2/+3
|/ | | | This is a broken link when built without --document-private-items.
* tor-guardmgr: Derive Ord for VanguardMode.Gabriela Moldovan2024-04-111-6/+2
|
* tor-guardmgr: Expand on a TODO about handling config changes.Gabriela Moldovan2024-04-111-0/+4
|
* tor-guardmgr: Add a TODO about updating has_onion_svc on reconfigure.Gabriela Moldovan2024-04-111-0/+1
|
* tor-guardmgr: Fix typo in VanguardMgr error message.Gabriela Moldovan2024-04-111-1/+1
|
* tor-guardmgr: Read the VanguardMode from VanguardParams.Gabriela Moldovan2024-04-111-26/+54
| | | | | | Based on our discussion on https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/258#note_3011734 If it turns out this is not the behaviour we want, we can update `Inner::mode()` accordingly.
* tor-guardmgr: Store whether we're running an onion svc.Gabriela Moldovan2024-04-111-1/+8
| | | | | | The `VanguardMgr` needs to know whether arti is running as an onion service or not, in order to figure out which of the `vanguards_enabled` and `vanguards_hs_service` modes to use.
* tor-guardmgr: Replace vanguard heap with a simpler approach.Gabriela Moldovan2024-04-101-107/+93
| | | | | | | | | | | | | | | | | | As mentioned in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2075#note_3016306 using a heap isn't the best way to manage the vanguards: * in the default case, which will apply to most users, the L2 and L3 set sizes are 4 and 8 respectively. Using a heap doesn't make sense for such small sets * the use of `Weak<TimeBoundVanguard>`s will be an inconvenience later on, when we implement vanguard set persistence, since `Weak` isn't serializable or deserializable This switches to a simpler apporach, where the `VanguardMgr` computes the soonest expiration timestamp of its `VanguardSet`s by iterating over all the vanguards in each set. Closes #1366
* tor-guardmgr: Do not store the NetDir in VanguardMgr.Gabriela Moldovan2024-04-101-31/+23
| | | | | Instead, we try to get a `NetDir` from the `NetDirProvider` each time we `run_once()`.
* tor-guardmgr: Remove unnecessary call to discard_expired().Gabriela Moldovan2024-04-101-2/+8
|
* tor-guardmgr: Rename vanguards to vanguards heap for clarity.Gabriela Moldovan2024-04-101-12/+12
|
* tor-guardmgr: Remove unused params field.Gabriela Moldovan2024-04-101-4/+0
|
* tor-guardmgr: Hold a weak reference to NetDirProvider.Gabriela Moldovan2024-04-101-7/+14
|
* tor-guardmgr: Don't recreate the event stream for each iteration (fmt).Gabriela Moldovan2024-04-101-1/+7
|
* tor-guardmgr: Don't recreate the event stream for each iteration.Gabriela Moldovan2024-04-101-3/+5
|
* tor-guardmgr: Only replenish the L3 sets if full vanguards are in use (fmt).Gabriela Moldovan2024-04-101-8/+2
|
* tor-guardmgr: Only replenish the L3 sets if full vanguards are in use.Gabriela Moldovan2024-04-101-33/+54
|