summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
* | memtrack docs: Wrap (whitespace changes, manual)Ian Jackson2024-04-231-28/+74
| | | | | | | | | | | | Use semantic newlines, not hugely long one-line paragraphs. (I think this file must originally have been a pad or a gitlab comment.)
* | memtrack docs: Move overview to lib.rsIan Jackson2024-04-231-0/+92
| |
* | tor-memtrack: Introduce new crate (empty)Ian Jackson2024-04-233-0/+72
| | | | | | | | | | | | | | Put it just above tor-rpcbase, which maybe it would want to use for metrics export via RPC? For now we have some dead code `#[allow]`s.
* | tor-error: Add ErrorKind::LocalResourceExhaustedIan Jackson2024-04-231-0/+6
| |
* | Switch to figment 1.0.18 and extract_lossyNick Mathewson2024-04-223-4/+4
| | | | | | | | | | | | | | The new (dubiously named) `Figment::extract_lossy` method can treat decode numbers from strings, and booleans from numbers or strings. This makes the behavior compatible with config-rs, and should (I hope) finally allow us to migrate.
* | Rename ConfigParseError => ConfigLoadErrorNick Mathewson2024-04-221-8/+15
| | | | | | | | | | Figment can give an error under more conditions than just a parsing failure, so we should report it a bit more vaguely.
* | Add an action field to Io error in tor-config.Nick Mathewson2024-04-222-15/+24
| |
* | Convert tor-config to use figment.Nick Mathewson2024-04-227-104/+138
|/ | | | | There are probably ways to make this a bit more elegant, but at least the tests still pass.
* Merge branch 'rpc_method_syntax_redux' into 'main'Nick Mathewson2024-04-227-397/+351
|\ | | | | | | | | | | | | RPC: Even more cleanup on invocable functions. Closes #838 See merge request tpo/core/arti!2084
| * rpc: add a comment from diziet to explain why we need same_declNick Mathewson2024-04-221-0/+6
| |
| * rpc: reformat macro slightly.Nick Mathewson2024-04-221-2/+5
| |
| * Rename Invoker trait to Invocable.Nick Mathewson2024-04-221-15/+15
| |
| * Fix rustdoc links.Nick Mathewson2024-04-221-2/+2
| |
| * Adjust an allow.Nick Mathewson2024-04-221-1/+1
| |
| * rpc:Sketch out the syntax of our remaining tricky macrosNick Mathewson2024-04-221-2/+8
| |
| * RPC: Remove installable_rpc_invoke_fnNick Mathewson2024-04-221-128/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we've done more refactoring, it's no longer necessary to have this machinery, since: * We can support statically registering instantiated methods, if we know them ahead of time. * Writing an installer function is pretty simple, and the syntax is much nicer than the special-purpose junk we had before. I've added examples of both approaches. While we're at it, I've simplified the syntax for `invoker_ent!` a little, since the parentheses I had before aren't necessary.
| * RPC: Remove method and object type from macros.Nick Mathewson2024-04-223-24/+22
| | | | | | | | | | These are no longer needed, since they are inferred from the types of the functions.
| * rpc: Revise backend for dispatchable-object macro.Nick Mathewson2024-04-225-260/+261
| | | | | | | | | | | | | | | | | | The trick here is to provide an `Invoker` trait, with blanket implementations for appropriate `fn(_,_,_,_?) -> _`. With this trick, we no longer need to have a `decl_rpc_invoke_fn`. This lets us discard HasConstTypeId entirely, and will let us simplify some other syntax moving forward.
* | tor-guardmgr: Remove unnecessary VanguardSetsTrackedMut contraption (fmt).Gabriela Moldovan2024-04-221-1/+2
| |
* | tor-guardmgr: Remove unnecessary VanguardSetsTrackedMut contraption.Gabriela Moldovan2024-04-222-177/+25
| | | | | | | | | | | | | | | | 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-222-27/+14
| | | | | | | | 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-222-4/+4
| | | | | | | | | | 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-222-3/+21
| |
* | 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: Derive PartialEq for VanguardSets.Gabriela Moldovan2024-04-221-3/+3
| | | | | | | | This will be useful for testing.
* | 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: Make VanguardSet private.Gabriela Moldovan2024-04-221-18/+10
| | | | | | | | | | | | This doesn't need to be `pub(super)` anymore, `VanguardMgr` now manipulates the `VanguardSets` exclusively through `VanguardSetsTrackedMut`.
* | 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-223-225/+373
| | | | | | | | | | | | 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 VanguardSetsTrackedMut for mutating VanguardSets.Gabriela Moldovan2024-04-221-0/+54
| | | | | | | | | | | | | | | | | | This enables us to track when `VanguardMgr`'s `VanguardSets` is *actually* mutated. This will soon be useful because we only want to flush the `VanguardSets` to storage if we actually added or removed some relays from the set.
* | tor-guardmgr: Add some accessors for VanguardSets.Gabriela Moldovan2024-04-221-0/+43
| | | | | | | | | | These will be useful later, when we place the `l2_vanguards` and `l3_vanguards` from `VanguardMgr` with a `VanguardSets`.
* | tor-guardmgr: VanguardSet::remove_{unlisted,expired} returns whether the set ↵Gabriela Moldovan2024-04-221-5/+14
| | | | | | | | | | | | | | | | | | changed. The two removal functions now return whether any values were removed from the `VanguardSet`. Their return values are currently ignored, but will soon be used for deciding whether to flush the `VanguardSet`s to disk (if full vanguards are enabled).
* | 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: Introduce an abstraction over the two vanguard sets.Gabriela Moldovan2024-04-221-0/+19
| | | | | | | | | | | | | | `VanguardSets` (not to be confused with `VanguardSet`) will soon be used as: * a helper for serializing the L2 and L3 `VanguardSet`s * an abstraction over the two vanguard sets
* | tor-guardmgr: Derive Default for VanguardSet.Gabriela Moldovan2024-04-221-1/+6
| | | | | | | | | | | | | | | | | | | | We will soon replace `VanguardSet::new` with `VanguardSet::default`: `new()` currently expects a set of `VanguardParams` (from which the target size of the set is derived), but we don't have a `VanguardParams` until we obtain a `NetDir`. Moreover, it doesn't make sense to attempt to set the target size of the `VanguardSet` before obtaining a `NetDir`, because we can't actually populate the set without a `NetDir` (we can't select relays).
* | tor-guardmgr: By default, use full vanguards for onion services.Gabriela Moldovan2024-04-221-2/+2
| | | | | | | | | | | | | | By default, HS clients should be using lite vanguards, and HS services full vanguards. See https://gitlab.torproject.org/tpo/core/torspec/-/merge_requests/258#note_3011734
* | 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-222-3/+2
| | | | | | | | Closes #1364