summaryrefslogtreecommitdiff
path: root/crates/tor-hsservice/src/publish
Commit message (Collapse)AuthorAgeFilesLines
* extract tor_async_utils::oneshot into ::oneshot-fused-workaroundJim Newsome2024-08-281-1/+1
| | | | | | | | | | | | | | Having this in the `tor-async-utils` crate prevents us from doing both of the following without introducing a circular dependency: * using it in `tor-rtmock` (which we currently do, particularly in tests). * using `tor-rtmock` to test things in `tor-async-utils`. We don't do this yet, but it is generally sensible to do so. In particular we want to move the `stream_peak` module there, which is currently tested with `tor-rtmock`. Moving this into its own crate avoids this circular dependency.
* 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.
* tor-hsservice: Always recreate the file watcher if the config changes.Gabriela Moldovan2024-08-271-59/+6
| | | | | | While this means we will be recreating the watcher slightly more often than necessary, this new approach is less error-prone than what we had before.
* tor-hsservice: Add a TODO about rethinking publish rate-limiting.Gabriela Moldovan2024-08-211-0/+11
|
* tor-hsservice: Add TODO about updating publisher status on error.Gabriela Moldovan2024-08-211-0/+1
| | | | | This is a general issue with the publisher that will need to be addressed soon.
* tor-hsservice: Update the authorized_clients and watcher when the config ↵Gabriela Moldovan2024-08-211-1/+5
| | | | changes.
* tor-hsservice: Store a FileWatcher in the publisher reactor.Gabriela Moldovan2024-08-211-2/+137
| | | | | This `FileWatcher` is watching the `restricted_discovery.key_dirs` directories for changes.
* tor-hsservice: Schedule descriptor republication whenever the key_dirs ↵Gabriela Moldovan2024-08-211-1/+57
| | | | contents change.
* tor-hsservice: Add helper for reading authorized_clients.Gabriela Moldovan2024-08-211-8/+17
| | | | | This will soon be used in the `key_dirs` change handler, which will re-read the authorized_clients list.
* tor-hsservice: Add channel for receiving key_dirs change events.Gabriela Moldovan2024-08-211-0/+11
|
* tor-hsservice: Log a message whenever restricted discovery mode is toggled.Gabriela Moldovan2024-08-211-0/+13
|
* tor-hsservice: Only republish if the config changes are relevant.Gabriela Moldovan2024-08-211-8/+1
| | | | | | | | | | | | Previously, the publisher would always publish a new descriptor if the config changed. Now, it only republishes if the parts of the config that changed are relevant (i.e. if they are part of `OnionServiceConfigPublisherView`). A future change will make it so that we trigger a republish task whenever the restricted discovery mode authorized clients change. This will involve looking at the contents of the configured `key_dirs`, as well as the `OnionServiceConfigPublisherView`.
* tor-hsservice: Make the reactor take a reference to the config.Gabriela Moldovan2024-08-211-2/+2
| | | | This resolves a clippy warning.
* tor-hsservice: Use OnionServiceConfigPublisherView in the publisher.Gabriela Moldovan2024-08-212-16/+11
| | | | | Resolves the TODO prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1603#note_2944902
* tor-hsservice: Log the client nicknames the descriptor is encrypted for.Gabriela Moldovan2024-08-211-1/+4
| | | | Knowing the nicknames can be useful when debugging.
* tor-hsservice: Log if we are about to generate a new descriptor.Gabriela Moldovan2024-08-211-0/+1
|
* Resolve unreachable_patterns warnings from nightly.Nick Mathewson2024-08-131-16/+13
| | | | | | | | | | | | | | Nightly rust doesn't like it when you have a `match` arm that can never be reached because of an uninhabited type. As such, we can't say stuff like: ``` let x: Option<Void> = ...; match x { Some(_) => unreachable!(), None => ... } ```
* tor-hsservice: Move authorized_clients out of RunningOnionService.Gabriela Moldovan2024-08-131-2/+9
| | | | | | We now create the authorized_clients in the publisher (we don't need the authorized_clients anywhere else, so it makes little sense to keep them in `RunningOnionService`).
* tor-hsservice: Add an extra log in the descriptor publisher.Gabriela Moldovan2024-08-051-0/+4
| | | | This helped me debug some shadow test failures.
* tor-hsservice: Use the configured authorized clients when encrypting the ↵Gabriela Moldovan2024-08-052-8/+31
| | | | descriptor.
* tor-hsservice: Remove unnecessary let-binding.Gabriela Moldovan2024-07-091-1/+2
|
* tor-hsservice: Specify the type when discarding value.Gabriela Moldovan2024-07-092-3/+3
| | | | | | | This should give us some confidence that we are not accidentally discarding results we should actually be using. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2251#note_3046219
* tor-hsservice: Ignore uninteresting netdir events in the publisher.Gabriela Moldovan2024-07-091-1/+12
| | | | This also makes the publisher exit if the netdir event stream ends.
* tor-hsservice: Resolve warning about unused response variable.Gabriela Moldovan2024-07-091-1/+1
| | | | | | | | | It is OK to discard the response string (the response is validated below where we call `DirResponse::into_output_string()`). (Perhaps we should just make `DirResponse::check_ok()` public. That way, we could validate the response without having to handle its output string).
* tor-hsservice: Resolve a handful of unused variable warnings.Gabriela Moldovan2024-07-092-4/+4
|
* tor-hsservice: Remove unused field from TimePeriodContext.Gabriela Moldovan2024-07-091-3/+0
|
* tor-hsservice: Remove unused variables.Gabriela Moldovan2024-07-092-14/+0
|
* tor-hsservice: Remove unnecessary locking.Gabriela Moldovan2024-07-091-2/+0
|
* tor-hsservice: Remove unused code.Gabriela Moldovan2024-07-092-186/+0
| | | | This is being reimplemented as #1292
* tor-hsservice: Remove unused publisher functions.Gabriela Moldovan2024-07-091-5/+0
| | | | | | | This removes a couple of unimplemented functions. These were supposed to be the starting point for #1217, but we won't be implementing that any time soon.
* Work around clippy::doc_lazy_continuation false positivesIan Jackson2024-07-081-4/+4
| | | | | | | See https://github.com/rust-lang/rust-clippy/issues/13001 I think it's OK to change this in our tree, nevertheless.
* tor-hsservice: Move optional timeout to optionally_timeout().Gabriela Moldovan2024-04-021-7/+32
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2064#note_3014793
* tor-hsservice: s/timeout/overall_timeout for clarity.Gabriela Moldovan2024-04-021-2/+2
|
* tor-hsservice: Add a test for the backoff runner's single_attempt_timeout().Gabriela Moldovan2024-04-021-0/+51
|
* tor-hsservice: Use single_attempt_timeout in backoff Runner impl (fmt).Gabriela Moldovan2024-04-021-10/+10
|
* tor-hsservice: Use single_attempt_timeout in backoff Runner impl.Gabriela Moldovan2024-04-022-19/+38
| | | | | | | | | | | | | | | | | !2024 introduced `BackoffSchedule::single_attempt_timeout()`, partially implementing #1259. This completes the implementation by moving the per-iteration timeout from the publisher reactor to `backoff::Runner`. Addresses https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2024?commit_id=a4f2bf5cb7d4027a49b74ec5a5298f7b9a3cf62e#note_3005097 Note: the `if should_retry` block is intentionally misindented, to make reviewing the actual changes easier. A future commit will fix the indentation. I originally wanted to suggest reviewing this commit using `--ignore-space-change`, but I found that it makes things a bit confusing (it shows some funky indentation around the parts that have both whitespace changes and modifications). Closes #1259
* Run maint/add_warning.Nick Mathewson2024-03-133-0/+3
|
* Fix some rustdoc warnings.Nick Mathewson2024-03-122-4/+4
| | | | | These are mostly about explicitly linking to things that were already in scope.
* BackoffSchedule refactoring and improvementsNeel Chauhan2024-03-072-22/+38
|
* tor-hsservice: client auth: Only allow `dir:...` to have valid unicodeIan Jackson2024-03-051-2/+2
| | | | | | | | | | | | We have Display/FromStr for AuthorizedClientConfig. We can't have Display if it can containa PathBuf because a PathBuf may not have a string representation. If we want to support non-unicode in the future, we'll need an escaping scheme and messing around with OsStr. The config scheme here may not be the best, but right now I'm just fixing uses of Path::display.
* tor-hsservice: prelude: Don't import postage::sink::SendErrorIan Jackson2024-03-051-4/+3
| | | | This is too vague.
* tor-hsservice: prelude: Move imports from reupload_timer.rsIan Jackson2024-03-051-4/+1
|
* tor-hsservice: prelude: Promote imports from reactor.rsIan Jackson2024-03-051-4/+0
| | | | Move these two publisher-specific imports to publish.rs.
* tor-hsservice: prelude: Move imports from reactor.rsIan Jackson2024-03-051-48/+2
|
* tor-hsservice: Refer to mpsc::{Sender, Receiver} by their module nameIan Jackson2024-03-051-4/+4
| | | | Just "Sender" and "Receiver" is rather vague.
* tor-hsservice: prelude: Promote imports from descriptor.rsIan Jackson2024-03-051-1/+0
| | | | Move these two publisher-specific imports to publish.rs.
* tor-hsservice: prelude: Move imports from descriptor.rsIan Jackson2024-03-051-21/+2
| | | | We use these via an import of the parent, publish.rs.
* tor-hsservice: prelude: Move imports from backoff.rsIan Jackson2024-03-051-11/+1
|