aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-hsservice/src/publish/reactor.rs
Commit message (Collapse)AuthorAgeFilesLines
* Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-151-4/+0
|
* hsservice: Advertise flowctrl and cgo as appropriate.Nick Mathewson2026-07-021-0/+1
| | | | | We put this behind a feature because we probably want to test this out before we enable it.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-091-0/+1
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* hsservice: Set the current random value for the custom netdirGabriela Moldovan2026-05-211-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This test was supposed to set both the current and the previous SRV in the test netdir, but was actually only setting the previous one. With the new SRV fixes from ee07c441909b41d5fbbfbffae310e954a69db478, all the hsservice tests using this netdir were panicking on an `.unwrap()`, because the SRV for the "previous" TP could not be found, which is actually what you'd expect to happen, given that the netdir was built with only one SRV. The reason the tests weren't failing before is, funnily enough, because of the bug in SRV calculation that is fixed in ee07c441909b41d5fbbfbffae310e954a69db478: In `tor-netdir`, the `extract_srvs()` function (correctly) only returned a single SRV from the consensus (the "previous one", set with `bld.shared_rand_prev()` in the test), but the `find_params_for_time()` was wrongly matching up that same SRV with multiple time periods. This happened because the old implementation was computing the "previous SRV" validity interval as: * ts_begin = `[start_of_day_containing(consensus_ts) - ONE_DAY` * ts_end = `ts_begin + srv_interval` And because the test SRV interval is 288h(!), and the test TP length is only 24h, the validity period of the previous SRV (incorrectly) covered two TPs (both the previous and the current). So as a result, the test was "successfully" getting back the same SRV for both the previous and the current TP. The bug was introduced in the commit that originally added the hsservice tests: 279842526591918e25ca97e6392f211a50192396
* dirclient, hsservice: Use Arc<str> for hsdesc publishing.Nick Mathewson2026-05-121-2/+3
| | | | | This saves a little memory, but the technique will help save more memory for other uploads.
* Fix word duplicate typosTobias Stoeckmann2026-03-151-1/+1
|
* hsservice: Remove unnecessary wraps from publisher functionGabriela Moldovan2026-01-271-4/+4
| | | | This lint triggers now that the unnecessary `async` is gone.
* hsservice: Remove unnecessary async from publisher functionGabriela Moldovan2026-01-271-3/+3
|
* opentelemetry: Instrument a bunch of functions.Wesley Aptekar-Cassels2025-11-241-0/+2
| | | | | These are all aimed at figuring out in more detail what's going on in #2079 and related issues.
* Fix name of clippy lint to unchecked_time_subtraction (2)Ian Jackson2025-11-061-1/+1
| | | | Run maint/add_warning
* hsservice: Move derive_more::From out of internal_prelude.Nick Mathewson2025-08-191-0/+1
| | | | | | | | | | | | | | This fixes an error from nightly. The trouble is that with nightly, there's a now a [derive macro for From][issue]. That doesn't cause a conflict when we `use derive_more::From`, but it _does_ cause a conflict when we import `derive_more::From` via `use internal_prelude::*`. So as a solution, we just import `derive_more::From` explicitly. Closes #2124 [issue]: https://github.com/rust-lang/rust/pull/144922
* misc: cleanup now that `_report!` macros support fieldsSteven Engler2025-08-181-1/+1
|
* proto: Move the `stream` module under `client` (breaking).Gabriela Moldovan2025-08-181-1/+1
| | | | | | | | | | | | The `stream` module is client-specific, for the most part, so I am moving it under `client`. Later on, we will factor out the parts that can be shared with the relay implementation. Note: this is a breaking change as the deleted `stream` module was `pub`. We could've kept the module and reexported from it the public types from `tor_proto::client::stream`, but I think it's better to have this `client` namespacing, because it makes the separation between the client and relay parts clearer.
* Switch Cargo.toml files to edition 2024.Nick Mathewson2025-08-071-2/+6
| | | | | | | | | | | | | | First, run ``` git grep -l "^edition =" | xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;' ``` Second, manually verify that all Cargo.toml files have changed, and nothing else has changed. Third, run cargo fmt again.
* hs: Use the new Tunnel interface for onion serviceDavid Goulet2025-08-051-24/+20
|
* netdoc, hsservice: Respect maximum descriptor sizesNick Mathewson2025-07-101-0/+7
| | | | | It would be better to take a more sophisticated approach; see #2048.
* hs*: Define some HsDesc errors as _suspicious_.Nick Mathewson2025-07-101-2/+32
| | | | | These errors are suspicious as hsdir inflation attacks, in the context of prop360.
* hs*: Include SourceInfo when making HsDesc requests.Nick Mathewson2025-07-101-2/+12
|
* *: suppress cognitive_complexity warnings from nightlyNick Mathewson2025-05-291-0/+3
| | | | | | | | | | | | | Apparently clippy nightly is better (or worse?) about detecting complex functions than before, so I'm suppressing these warnings where they occur. I have mixed feelings about these warnings: On the plus side, they really do help to detect functions that are twistier than they need to be. On the minus side, they get confused by tracing macros, and the "allows" do pile up. But on the plus side, those "allows" do provide a way to find functions that need to be refactored, and they are never uglier than the functions they decorate.
* tor-hsservice: Initial parts of PowManager.Wesley Aptekar-Cassels2025-05-271-0/+18
| | | | | | | This adds PowManager, as described in doc/dev/notes/service-side-pow.md, hooks it into IptManager and Publisher, and adds code to publish and rotate seeds, and to keep a updated list of Verifier instances for currently active seeds.
* Use an EntropicRng trait to enforce key generation rules.Nick Mathewson2025-03-241-0/+2
| | | | | | | | | | | We want to require that whenever we generate a key that's persistent (stored in KeyMgr), it's going to be made from a stronger-than-usual Rng. This trait helps us enforce that. We also add a FakeEntropicRng struct to use for testing. Note that this turned up a case that we'd missed, which required an internal change in tor-hsservice.
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-181-1/+1
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* Move helpers from tor-hsservice to tor-netdir.Wesley Aptekar-Cassels2024-11-251-2/+5
| | | | | These helpers seem potentially broadly useful, and only really discoverable if they're here.
* tor-hsservice: add clippy allowsSteven Engler2024-11-201-0/+4
|
* update `CfgPath::path` to use a `CfgPathResolver`Steven Engler2024-11-181-2/+2
| | | | | | | | | | | | | | | | This is a big change across multiple crates since there isn't a good way to break it up. This changes the signature of `CfgPath::path` to: ``` pub fn path(&self, path_resolver: &CfgPathResolver) -> Result<PathBuf, CfgPathError> { ``` Making this change means that our global `CfgPathResolver` needs to be stored in the 'arti-client' library instead of `tor-config-path`, and must be passed through to anything that calls `path` to expand the variables.
* tor-hsservice: pass through the `CfgPathResolver`Steven Engler2024-11-181-8/+19
|
* tor-config: removed re-export of `CfgPath`Steven Engler2024-11-041-1/+2
| | | | | Also updated other packages to get `CfgPath` directly from `tor-config-path' instead of 'tor-config'.
* Introduce mpsc_channel_no_memquota and use it in the places it's wantedIan Jackson2024-10-151-1/+2
| | | | | These are the call sites where using this fucntion is correct. (Outside tor-rtmock, which we'll do separately.)
* Merge branch 'bug_1613' into 'main'gabi-2502024-09-121-1/+1
|\ | | | | | | | | | | | | Bug 1613: Add support for inserting externally generated and removing arbitrary service discovery keys Closes #1613 See merge request tpo/core/arti!2396
| * tor-keymgr: add an overwrite flag to KeyMgr::insert()Morgan2024-09-101-1/+1
| |
* | tor-hsservice: Add tests for status changes induced by descriptor uploads.Gabriela Moldovan2024-09-091-1/+185
| |
* | tor-hsservice: Include descriptor upload errors in onion service status.Gabriela Moldovan2024-09-091-9/+17
| |
* | tor-hsservice: Change the error type in Problem::DescriptorUpload.Gabriela Moldovan2024-09-091-1/+17
| | | | | | | | | | | | | | | | We will need to return a list of descriptor upload errors. We can't return a `Vec<RetryError<DescUploadError>>` here because `DescUploadError` is a lower-level error type that can't express that e.g. the upload timed out.
* | tor-hsservice: Remove unused UploadError variant (fmt).Gabriela Moldovan2024-09-091-3/+1
| |
* | tor-hsservice: Remove unused UploadError variant.Gabriela Moldovan2024-09-091-6/+1
| | | | | | | | | | We never return `UploadError::Timeout` (timeouts are represented as `BackoffError::Timeout`).
* | tor-hsservice: Rename UploadStatus to UploadResult.Gabriela Moldovan2024-09-091-4/+4
| | | | | | | | This type is a `Result`, renaming for clarity.
* | tor-hsservice: Fill out the missing descriptor publisher docs.Gabriela Moldovan2024-09-091-7/+62
| | | | | | | | Closes #1216
* | tor-hsservice: Return Bug where possible.Gabriela Moldovan2024-09-091-4/+4
| | | | | | | | | | This makes it clearer that some of these functions are essentially infallible.
* | tor-hsservice: Update docs with new status reporting logic.Gabriela Moldovan2024-09-091-12/+32
| |
* | tor-hsservice: Validate the authorized clients before publishing.Gabriela Moldovan2024-09-091-1/+39
| | | | | | | | | | This enables us to report a "broken" service status if restricted discovery is enabled but the authorized_clients list is empty.
* | tor-hsservice: Set the publisher State based on the upload results.Gabriela Moldovan2024-09-091-29/+106
| | | | | | | | Closes #1572
* | tor-hsservice: Store the upload result in TimePeriodContext.Gabriela Moldovan2024-09-091-2/+33
| | | | | | | | | | | | This will allows us determine the ComponentStatus of the publisher (it'll be either `Running` or `Degraded`, depending on whether the upload failed).
* | tor-hsservice: Don't update the onion svc status when publisher goes idle.Gabriela Moldovan2024-09-091-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | After uploading the descriptor, the publisher transitions into the `Idle` state. This transition happens even if the upload was unsuccessful, so it shouldn't cause the onion service status to become `Running` (because `Running` implies the service is fully reachable, and if the publisher failed to upload the descriptor to some or all HsDirs, that won't necessarily be the case). A future commit will set the publisher's onion svc `State` to `Running`/`Recovering`/`Broken` according to the upload status.
* | tor-hsservice: Add a comment noting where the publisher tests live.Gabriela Moldovan2024-09-091-0/+2
| |
* | tor-hsservice: Replace UploadStatus enum with type alias.Gabriela Moldovan2024-09-091-24/+6
| | | | | | | | This resolves a TODO.
* | tor-hsservice: Store the authorized_clients in the mutable state of the reactor.Gabriela Moldovan2024-09-091-15/+17
| | | | | | | | | | | | Previously, these were stored in the immutable state behind a mutex, but since they're not really immutable (we update them if the config changes), it makes more sense to put them in `State`.
* | tor-hsservice: Move a misplaced TODO.Gabriela Moldovan2024-09-091-1/+1
|/ | | | | | This TODO was added in !2353 and was supposed to be about reporting a broken/degraded onion service status if the restricted discovery config watcher fails.
* tor-hsservice: Recreate the file watcher on every key_dir change event.Gabriela Moldovan2024-08-271-0/+3
| | | | | | | This ensures that if a directory used as a `key_dir` is moved (e.g. renamed), and then moved back to its original location (the one specified in `key_dirs`), our watcher continues watching the `key_dirs` contents.
* tor-config: Rename watch_file to watch_path.Gabriela Moldovan2024-08-271-2/+2
| | | | `FileWatcher::watch_file` can be used with arbitrary paths.
* tor-hsservice: Make sure we always watch the parents of the key_dirs.Gabriela Moldovan2024-08-271-15/+24
| | | | | This ensures that if a `key_dir` is created after we start watching it (or if it's moved), we are still able to detect changes.