summaryrefslogtreecommitdiff
path: root/crates/tor-hsservice
Commit message (Collapse)AuthorAgeFilesLines
...
* | tor-hsservice: Add a FatalError::from_spawn.Gabriela Moldovan2023-12-131-0/+12
| | | | | | | | We're about to use this (in the publisher reactor).
* | tor-hsservice: Replace ReactorError::ShuttingDown with ShutdownStatus.Gabriela Moldovan2023-12-131-13/+33
| |
* | tor-hsservice: Make descriptor publisher wait for shutdown signal.Gabriela Moldovan2023-12-133-3/+29
| | | | | | | | | | | | | | | | The publisher logs a nice `info!` message when it receives the shutdown signal. The publisher can infer that the service is shutting down from the errors received on its various receiver channels (i.e. from the errors that suggest the sender was dropped), but listening for the shutdown signal is nicer.
* | tor-hsservice: Move ShutdownStatus to svc.Gabriela Moldovan2023-12-132-16/+18
| | | | | | | | | | | | | | This will be used by the descriptor publisher soon (we want to abolish its `ReactorError` altogether, and to do that, we need to get rid of `ReactorError::ShuttingDown`. `ShuttingDown::Terminate` happens to be a suitable replacement).
* | tor-hsservice: Remove unused ReactorError variant.Gabriela Moldovan2023-12-131-5/+0
| | | | | | | | | | This moves us one step closer to removing ReactorError in favour of FatalError (see the TODO HSS above ReactorError for more details).
* | tor-hsservice: Refactor upload_descriptor_with_retries to not return an error.Gabriela Moldovan2023-12-131-67/+60
| | | | | | | | | | | | | | | | | | | | | | | | Previously, this would return `ReactorError::PublishFailure` if the upload failed. However, that error wasn't used for anything other than logging. Instead of returning the error, we now log it inside `upload_descriptor_with_retries` and return an `UploadStatus` describing the upload outcome. This will enable us to abolish `ReactorError::PublishFailure` (and eventually replace `ReactorError` with `FatalError`).
* | tor-hsservice: Abolish ReactorError::HsDescBuild.Gabriela Moldovan2023-12-132-7/+3
|/ | | | | The failure to build a descriptor out of seemingly valid parts is an internal (irrecoverable) error.
* tor-hsservice: Reformat long match statement.Gabriela Moldovan2023-12-111-1/+3
|
* tor-hsservice: Reformat a long trace! statement.Gabriela Moldovan2023-12-111-1/+3
|
* tor-hsservice: Rephrase and reformat a comment.Gabriela Moldovan2023-12-111-2/+2
| | | | This line is too long.
* tor-hsservice: Remove duplicate trace! log.Gabriela Moldovan2023-12-111-5/+0
| | | | | We already log the outcome of the HsDir upload in the function that calls this code.
* tor-hsservice: Use debug! instead of trace! to log upload outcome.Gabriela Moldovan2023-12-111-1/+1
| | | | This also wraps the line.
* tor-hsservice: Remove some TODOs that have been addressed.Gabriela Moldovan2023-12-111-11/+0
|
* tor-hsservice: Publish the IptPublishSet we called note_publication_attempt on.Gabriela Moldovan2023-12-111-50/+50
| | | | | | | | | | | | | | | | | | | | | | Previously, it was possible for the `IptPublishSet` used to generate the descriptor and the `IptPublishSet` `note_publication_attempt` to differ. Now, the publisher generates the descriptor using the same `IptPublishSet` it calls `note_publication_attempt` on. Note that as a consequence, the publisher generates a new descriptor just before _each_ HsDir upload. This means each HsDir could, in theory, receive a different descriptor (not just in terms of revision-counters, but also with a different set of IPTs). It may seem like this could lead to some HsDirs being left with an outdated descriptor, but that's not the case: after the upload completes, the publisher will be notified by the ipt_watcher of the IPT change event (if there was one to begin with), which will trigger another upload job. Previously, the publisher would only generate a single descriptor for each time period (all HsDirs in a given time period would receive the same descriptor). Closes #1097
* tor-hsservice: Move revision_counter to HsDirUploadResult.Gabriela Moldovan2023-12-111-5/+5
| | | | | | This was previously in `TimePeriodUploadResult`. We will soon have different revision_counter for each `HsDirUploadResult`, so let's preemptively move the field there.
* tor-hsservice: Make build_sign also return the revision counter used.Gabriela Moldovan2023-12-112-10/+11
|
* tor-hsservice: Derive Clone for VersionedDescriptor.Gabriela Moldovan2023-12-111-0/+1
| | | | We're going to need to clone it soon.
* tor-hsservice: Move generate_revision_counter to Immutable.Gabriela Moldovan2023-12-111-74/+75
| | | | | | | | `generate_revision_counter` and `create_ope_key` don't use anything from `self` other than `imm`, so they might as well be methods on `Immutable`. This change is needed because we're soon going to need to use `generate_revision_counter` from an associated `Reactor` function (where we don't have `self`).
* Merge branch 'publisher-todos' into 'main'Ian Jackson2023-12-111-19/+25
|\ | | | | | | | | | | | | tor-hsservice: Remove a publisher TODO that has been addressed. Closes #1131 See merge request tpo/core/arti!1807
| * tor-hsservice: Reformat a long log line.Gabriela Moldovan2023-12-081-1/+5
| |
| * tor-hsservice: Add more context to the publisher logs.Gabriela Moldovan2023-12-081-10/+20
| |
| * tor-hsservice: Remove a publisher TODO that has been addressed.Gabriela Moldovan2023-12-081-8/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The publisher doesn't reupload unless explicitly asked to do so by the `IptManager` (via `await_update()`). Also, when the consensus changes, we always trigger a reupload, but only to those HsDirs that don't already have the descriptor (the HsDirs marked as "clean" stay "clean", and any new HsDirs are marked "dirty" until they get a copy of the descriptor. See !1806). Similarly, a config change only triggers a reupload if the change means we need to generate a new descriptor (e.g. if the `anonymity` of the service changes). Note, however, that this logic is currently commented out (it depends on #1028). Closes #1131
* | tor-hsservice: Add functions to update the IPT mgr/publisher states.Gabriela Moldovan2023-12-111-7/+21
| | | | | | | | Part of #1083
* | tor-hsservice: Derive service state from the state of its components.Gabriela Moldovan2023-12-111-1/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to know the status of each component to be able to report the overall status of the service. Without this change, the service (and its components) have no way of knowing if a given transition is valid: if the state of a component (say, the IPT manager) is `Bootstrapping`, `Recovering` or `Broken`, a transition out of the current state is only valid if it is initiated by the same component that caused the current state (for example, if the publisher sets the state to `Recovering`, the IPT manager should not be allowed to trigger an overall state transition to `Running`). Part of #1083
* | tor-hsservice: Trim trailing whitespace.Gabriela Moldovan2023-12-111-1/+1
|/
* tor-hsservice: Remove unused lifetime.Gabriela Moldovan2023-12-071-1/+1
| | | | Fixes a clippy lint.
* tor-hsservice: Remove unused function.Gabriela Moldovan2023-12-071-16/+0
|
* tor-hsservice: Fix publisher bug causing unnecessary uploads.Gabriela Moldovan2023-12-071-27/+31
| | | | | | | This fixes a bug where the publisher wasn't preserving the `DescriptorStatus` of its `HsDirs` when handling consensus changes. The bug is described in more detailed in the TODO removed by this commit.
* tor-hsservice: Add a TODO about a publlisher bugGabriela Moldovan2023-12-071-0/+17
|
* tor-hsservice: Rename period to ctx for clarity.Gabriela Moldovan2023-12-071-2/+2
| | | | This is actually a `TimePeriodContext`.
* Merge branch 'persist-macro' into 'main'Ian Jackson2023-12-076-96/+78
|\ | | | | | | | | | | | | Improve KeySpecifier, errors, IptKeySpecifier impl, etc. Closes #1116 and #1148 See merge request tpo/core/arti!1796
| * tor-hsservice: keys: Remove unused imports (and a blocking todo)Ian Jackson2023-12-071-2/+0
| |
| * tor-hsservice: tests: IptKeySpecifier: Do round trip testIan Jackson2023-12-071-8/+8
| |
| * tor-hsservice: IptKeySpecifier: impl KeySpecifier via macroIan Jackson2023-12-071-14/+8
| |
| * tor-hsservice: IptKeySpecifier: make it ownedIan Jackson2023-12-072-5/+5
| | | | | | | | | | The macro is going to want to be able to do a back-conversion from an ArtiPath, so there has to be an owned version.
| * tor-hsservice: IptKeySpecifier: reorder fieldsIan Jackson2023-12-071-2/+2
| | | | | | | | | | Now they are in the order they appear in the ArtiPath, which is a bit clearer.
| * tor-hsservice: IptKeyRole: impl FromStr and KeySpecifierComponentIan Jackson2023-12-071-1/+4
| |
| * tor-hsservice: IptLocalId: impl KeySpecifierComponentIan Jackson2023-12-071-0/+3
| |
| * tor-hsservice: IptLocalId: impl FromStr (fmt)Ian Jackson2023-12-071-4/+2
| |
| * tor-hsservice: IptLocalId: impl FromStrIan Jackson2023-12-072-27/+18
| | | | | | | | And implement serde that way, using SerdeStringOrTransparent.
| * tor-hsservice: Expose SerdeStringOrTransparent to crateIan Jackson2023-12-072-2/+4
| | | | | | | | | | And make it useable elsewhere by not expecting the particular error type.
| * tor-keymgr: Make KeySpecifierComponent::as_component fallibleIan Jackson2023-12-071-1/+1
| | | | | | | | | | | | | | | | | | | | This allows a principled implentation via Display. The alternative would be to have runtime panics whenever someone uses KeySpecifierComponentViaDisplayFromStr but the Display impl can produce wrong syntax (that doesn't fit in an ArtiPathComponent). Bug seems like the right error since implemnting KeySpecifierComponent implies that every value is representable in an ArtiPathComponent.
| * tor-keymgr: Introduce InvalidKeyPathComponentValue errors (fmt)Ian Jackson2023-12-071-9/+8
| |
| * tor-keymgr: Introduce InvalidKeyPathComponentValue errorsIan Jackson2023-12-071-1/+7
| | | | | | | | | | | | | | | | This is a variant in KeyPathError, which contains the actual wrong value, and the key name. But it is also a unit struct to return from the trait impl. This replaces ArtiPathError::InvalidDenotator.
| * tor-hsservice: Prepare for different denotator error handlingIan Jackson2023-12-071-5/+6
| | | | | | | | | | Save the ArtiPathComponent in a variable and separate out the Ok(tp) for clarity. No functional change.
| * tor-keymgr: Have KeySpecifierComponent::from_component take a refIan Jackson2023-12-071-1/+1
| | | | | | | | | | Call sites are shortly going to need the component on the error path, so this function ought probably not to consume it.
| * tor-keymgr: Replace assert_key_specifier_rountrip macro with function (fmt)Ian Jackson2023-12-071-12/+3
| | | | | | | | Formatting churn at call sites.
| * tor-keymgr: Replace assert_key_specifier_rountrip macro with functionIan Jackson2023-12-071-13/+8
| | | | | | | | The new function checks both directions. The (misspelled) macro didn't.
| * tor-keymgr: provide KeySpecifierComponentViaDisplayFromStr and use itIan Jackson2023-12-071-13/+2
| | | | | | | | Now the only manual impl is TimePeriod, which is indeed special.
| * ArtiPaths: derive FromStr for ArtiPath ArtiPathComponent HsNickname (fmt)Ian Jackson2023-12-071-2/+13
| | | | | | | | Mandatory horrible formatting.