summaryrefslogtreecommitdiff
path: root/crates/tor-hsservice/src/svc.rs
Commit message (Collapse)AuthorAgeFilesLines
* tor-hsservice: tests: Greak out mk_state_instance helperIan Jackson2024-02-131-3/+12
|
* tor-hsservice: Remove unnecessary loop (fmt).Gabriela Moldovan2024-02-011-12/+12
|
* tor-hsservice: Remove unnecessary loop.Gabriela Moldovan2024-02-011-4/+0
| | | | | We don't store public HsId key in the keystore anymore, so this test is not needed anymore.
* tor-hsservice: Rewrite maybe_generate_hsid using KeyMgr::generate (fmt).Gabriela Moldovan2024-02-011-45/+41
|
* tor-hsservice: Rewrite maybe_generate_hsid using KeyMgr::generate.Gabriela Moldovan2024-02-011-108/+42
| | | | | | | | | | | | | | | We will soon remove the `KeyMgr::*_with_derived()` functions, so we need to rewrite `maybe_generate_hsid` using `KeyMgr::get` and `KeyMgr::generate`. An important point to note is that `maybe_generate_hsid` no longer stores the `KP_hs_id` in the key store. The reason we originally put the `KP_hs_id` in the keystore in the first place was to support offline HsId mode. However, offline HsId mode was never fully implemented (#1194), and the decision to put the public part of the HsId in the keystore is controversial (#1195). We can revisit this decision when we implement #1194, but for now, we don't need a separate `KP_hs_Id` entry in the keystore.
* tor-hsservice: Extract the onion name from the keypair.Gabriela Moldovan2024-02-011-3/+6
| | | | We're about to stop storing the public part of the hsid in the keystore.
* Make the OnionServiceState type crate-private.Nick Mathewson2024-02-011-17/+22
| | | | Closes #1261.
* Merge branch 'high-level-docs' into 'main'Nick Mathewson2024-02-011-1/+19
|\ | | | | | | | | | | | | Add some higher-level documentation for tor-hsservice. Closes #1228 See merge request tpo/core/arti!1945
| * Correct description of parametersIan Jackson2024-02-011-1/+1
| |
| * Add some higher-level documentation for tor-hsservice.Nick Mathewson2024-01-311-1/+19
| | | | | | | | Closes #1228.
* | tor-hsservice: Remove now-unused importsIan Jackson2024-02-011-6/+3
| |
* | tor-hsservice: Use tor_persist::state_dir, etc. (fmt)Ian Jackson2024-02-011-10/+15
| |
* | tor-hsservice: Use tor_persist::state_dirIan Jackson2024-02-011-72/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We no longer do replay log locking in IptManager::new. Instead, we rely on the acquire_instance call in OnionService::launch, which ends up with ipt_mgr getting an InstanceHandle (which contains a lock guard). OnionServiceStateMgr is abolished; it existed to deal with the generics in the tor_persist::StateMgr API. state_dir has no generics (other than the T being loaded/stored). Many places (structs and argument lists) now have state_dir types which embody a path (or a CheckeDir) along with a lock, rather than separate path+lock+mistrust. The creation/startup code uses the new calls from state_dir. Other more minor changes: - StartupError::StateDirectoryInaccessible contains tor_persist::Error - test::create_storage_handles_from_state_dir changed and renamed, from _from_state_mgr. - replay::PersistFile's (separate) file lock is now fslock_guard's
* | tor-hsservice: tests: create_storage_handles: use a real directoryIan Jackson2024-02-011-0/+1
| | | | | | | | | | | | | | state_dir doesn't have the in-memory dummy implementation, so there will have to be a real directory here. Do that now, as prep.
* | tor-hsservice: storage: Move Arcs into type aliasesIan Jackson2024-02-011-6/+6
| | | | | | | | | | | | | | These are here because that's what you get from the tor_persist singleton StageMgr API (for type erasure reasons). We're going to change these to tor_persist::state_dir types and those don't involve Arcs.
* | tor-hsservice: tests: Add a missing drop callIan Jackson2024-02-011-0/+2
|/ | | | | | This doesn't actually change the behaviour with current Rust. But it avoids bugs and future changes. Relying on drop order for temporary directory lifetime seems bad.
* test-temp-dir: New crateIan Jackson2024-01-251-1/+1
| | | | | Introduce the crate, move the code motion, and make minimal necessary changes.
* test_temp_dir: Split up .used_byIan Jackson2024-01-251-1/+1
| | | | | | | | | | This method combined two things: 1. the lifetime guard API 2. creation of a subdirectory. 2 is available in raw form too, but not 1. So rename the combined method to .subdir_used_by and implement it in terms of a new .used_by which doesn't make a subdirectory.
* tor-hsservice: Remove some TODOs about setting the OnionService status.Gabriela Moldovan2024-01-241-2/+0
| | | | | | | | | | | | | Currently, the status of the `OnionService` is derived from the statuses of its subcomponents. Their initial status will be `Shutdown`, so we don't need to explicitly initialize it. As for setting the status when `RunnionOnionService::launch` fails, I don't think that's necessary: `launch()` returns an error on failure, so the user will know about it (it doesn't need to watch the stream of status events to find out it failed). Part of #1083
* tor-hsservice: Give the IptManager a StatusSender.Gabriela Moldovan2024-01-241-0/+3
| | | | Part of #1083
* tor-hsservice: Give the publisher a StatusSender.Gabriela Moldovan2024-01-241-0/+3
| | | | The publisher needs it to notify `OnionService` of status changes.
* tor-hsservice: key expiry: clippy followupIan Jackson2024-01-241-3/+2
| | | | | These are now the last uses of these values, so they need the "no clone" form.
* tor-hsservice: key expiry: Do publisher expiry from reactorIan Jackson2024-01-241-17/+1
| | | | | | | | | | | | | | In principle there is a small race with doing this in a separate task: the reactor and the sweeper might process the new netdir at different times. For example, if two netdir updates come in quick succession, and the sweeper is slower, the sweeper might still be running with the previous TPs as the publisher is creating keys in the new TPs. Theoretically, the sweeper might delete keys the reactor has just generated. This is also considerably simpler.
* Merge branch 'shutdown_on_drop' into 'main'gabi-2502024-01-191-6/+9
|\ | | | | | | | | | | | | Clarify shutdown behavior when RemoteOnionService is dropped. Closes #1238 and #1236 See merge request tpo/core/arti!1899
| * hsservice: Temporarily remove .pause() (formerly stop()).Nick Mathewson2024-01-181-0/+2
| | | | | | | | | | We don't need to implement this for our first release of onion services, but we shouldn't ship a function that calls todo!().
| * Clarify usage and behavior of shutdown_tx.Nick Mathewson2024-01-181-6/+7
| |
* | Mark ShutdownStatus as must_useNick Mathewson2024-01-181-0/+1
|/ | | | Followup from !1895.
* Merge branch 'publisher-shut-down' into 'main'Nick Mathewson2024-01-181-0/+1
|\ | | | | | | | | tor-hsservice: The publisher should exit when the IPT manager says so. See merge request tpo/core/arti!1895
| * tor-hsservice: The publisher should exit when the IPT manager says so.Gabriela Moldovan2024-01-181-0/+1
| | | | | | | | | | | | The publisher needs to shut down when `IptPublisherView::sawait_update()` returns `None`, not pause the uploads.
* | tor-hsservice: Store the StateMgr inside OnionServiceState.Gabriela Moldovan2024-01-181-17/+51
| | | | | | | | | | | | This introduces an internal `OnionServiceStateMgr` trait, which enables us to store the `StateMgr` inside the `OnionServiceState` (without having to parameterize `OnionServiceState` on `S: StateMgr`).
* | tor-hsservice: Add a test for OnionService::onion_name.Gabriela Moldovan2024-01-181-0/+31
| |
* | tor-hsservice: Move onion_name() to OnionServiceState.Gabriela Moldovan2024-01-181-55/+60
| | | | | | | | | | | | | | | | Both `OnionService` and `RunningOnionService` have an `onion_name()` function. To reduce code duplication, we can move `onion_name()` to a new `OnionServiceState` struct (which will grow more state management functions int he future), and make both `*OnionService` structs deref to it.
* | tor-hsservice: Add RunningOnionService::onion_name.Gabriela Moldovan2024-01-181-7/+42
| |
* | tor-hsservice: Add a couple of TODOs for #1247.Gabriela Moldovan2024-01-181-0/+2
| |
* | tor-hsservice: Do not store the StateMgr in OnionService.Gabriela Moldovan2024-01-181-7/+3
| | | | | | | | | | | | | | The `StateMgr` is currently only needed in `launch()`, so we don't really need to store it. This allows us to unparameterize OnionService.
* | tor-hsservice: Remove a couple of resolved TODOs.Gabriela Moldovan2024-01-181-3/+0
| |
* | tor-hsservice: Move onion_name() to OnionService.Gabriela Moldovan2024-01-181-0/+12
| | | | | | | | | | | | | | This a modified version of `tor_hsservice::state::StateMgr::onion_name`. `tor_hsservice::state::StateMgr` will soon be abolished. Part of #1220, #1227
* | tor-hsservice: Create a separate RunningOnionService type.Gabriela Moldovan2024-01-181-24/+72
| | | | | | | | | | | | | | | | This will enable us to construct non-launched (but configured) `OnionService`s. We need this, for example, for implementing the `arti hss` CLI command. Part of #1227
* | tor-hsservice: Rename stop() to pause().Gabriela Moldovan2024-01-181-1/+1
|/ | | | Part of #1227
* Add a couple more TODO references (to #1227)gabi-2502024-01-131-2/+2
|
* hsservice::svc: Lower "allows" to publish.rsNick Mathewson2024-01-121-2/+1
| | | | See #1232 for fixing the remaining part of these.
* Replace TODOs about stopping onion services with #1231.Nick Mathewson2024-01-121-2/+2
|
* Remove TODO about "doing something with" rend_req_rxNick Mathewson2024-01-121-3/+1
| | | | Turns out, we _do_ use this field.
* Change TODO about inconsistent state to #1230.Nick Mathewson2024-01-121-1/+1
|
* Link another status TODO to #1083Nick Mathewson2024-01-121-1/+1
|
* Note a reconfiguration TODO.Nick Mathewson2024-01-121-1/+1
|
* hsservice: comment out unimplemented add_keys function.Nick Mathewson2024-01-121-7/+6
|
* hsservice: Tag two TODOS having to do with status as #1083.Nick Mathewson2024-01-121-2/+2
|
* Downgrade TODO about "unlaunched" in SvcInner.Nick Mathewson2024-01-121-1/+1
|
* Remove unused keymgr from SvcInnerNick Mathewson2024-01-121-13/+2
| | | | (We can put it back later if we need it.)