summaryrefslogtreecommitdiff
path: root/crates
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | tor-hsservice: state_dir: Fix a wrong error stringIan Jackson2024-01-311-1/+1
| | | | | | | | | | | | | | | | We use `/` to separate, not `+`.
* | | | tor-hsservice: state_dir: Fix a wrong commentgabi-2502024-01-311-1/+1
| | | |
* | | | tor-hsservice: state_dir: Fix typogabi-2502024-01-311-1/+1
| | | |
* | | | state_dir: Deferred fmt churnIan Jackson2024-01-311-3/+1
| | | |
* | | | state_dir: When comparing path, use official separatorsIan Jackson2024-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | This would fix the tests on Windows I think ? (Tests which don't seem to run in routine CI AFAICT.)
* | | | state_dir: Use subdirectory rather than + notationIan Jackson2024-01-311-8/+9
| | | | | | | | | | | | | | | | As previously decided and documented.
* | | | state_dir: Break out make_secure_directory closureIan Jackson2024-01-311-4/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We're about to reuse this. This changes the Resource in the error to be more accurate, too. This will be more important as we add another call site.
* | | | state_dir: Introduce local PATH_SEPARATOR aliasIan Jackson2024-01-311-2/+3
| | | | | | | | | | | | | | | | We're going to want this some more.
* | | | tor-persist: sort Cargo.tomlIan Jackson2024-01-311-1/+1
| | | |
* | | | tor-persist: state_dir: Remove three unused allowsIan Jackson2024-01-311-3/+0
| | | |
* | | | tor-persist: state_dir: Test functionality that exists nowIan Jackson2024-01-312-0/+109
| | | |
* | | | tor-persist: state_dir: Enable rustfmt (formatting)Ian Jackson2024-01-311-15/+14
| | | | | | | | | | | | | | | | Remaining formatting churn.
* | | | tor-persist: state_dir: Implement StateDirectory::newIan Jackson2024-01-311-1/+17
| | | |
* | | | tor-persist: state_dir: Implement acquire_instanceIan Jackson2024-01-312-7/+157
| | | | | | | | | | | | | | | | | | | | | | | | | | | | And also instance_peek_storage, which needs to share some code, so determined the shape of this implementation. Make StateDirectory have the (one) field we need.
* | | | tor-persist: state_dir: Implement InstanceStateHandle and StorageHandleIan Jackson2024-01-311-8/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are the straightforward methods which, given a CheckedDir, perform the relevant operation. Make InstanceStateHandle have the necessary fields. Constructing an InstanceStateHandle is a bit complex and will come in a moment.
* | | | tor-persist: state_dir: Have instance id throw fmt::ErrorIan Jackson2024-01-311-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In practice, allowing Bug here was quite inconvenient for everyone. I think very few call sites will want to throw anything interesting. If they *do* want to cause an error, without panicking, they could write a syntactically invalid slug.
* | | | tor-persist: Error: Provide for handling LocalResourceAlreadyInUseIan Jackson2024-01-311-0/+5
| | | | | | | | | | | | | | | | | | | | state_dir doesn't support a "shared read-only" mode, so it needs an error.
* | | | tor-persist: Error: Provide for handling BadSlugIan Jackson2024-01-311-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a Bug variant. Then, use it for conversions from BadSlug. See the comment for why I think this is appropriate.
* | | | tor-persist: state_dir: Two API fixesIan Jackson2024-01-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | You don't need to consume a Mistrust to get a CheckedDir - you use a Verifier and then something clones it for you. So StateDirectory::new should take &Mistrust. And instance_peek_storage needs T to be deserialisable!
* | | | tor-persist: state_dir: Rename InstanceStateHandle::purge (from delete)Ian Jackson2024-01-311-2/+2
| | | | | | | | | | | | | | | | | | | | This is rather more serious than many deletions - it wipes out the whole directory. And this name goes better with purge_instances.
* | | | tor-persist: state_dir: Enable rustfmtIan Jackson2024-01-311-1/+0
| | | | | | | | | | | | | | | | The formatting will be normalised roughly as we go.
* | | | tor-persist: load_store: Add some tracingIan Jackson2024-01-311-3/+18
| | | | | | | | | | | | | | | | Now we get log messages about what we're reading/writing.
* | | | tor-persist: Fix a doc commentIan Jackson2024-01-311-1/+1
| |/ / |/| |
* | | tor-persist: Document that slugs cannot start with '-'.Gabriela Moldovan2024-01-311-1/+1
| | |
* | | tor-hsclient: Rename HsClientSpecifier to HsClientNickname (fmt).Gabriela Moldovan2024-01-312-4/+4
| | |
* | | tor-hsclient: Rename HsClientSpecifier to HsClientNickname.Gabriela Moldovan2024-01-314-13/+12
| | | | | | | | | | | | | | | Service nicknames are represented by `HsNickname`, so let's rename `HsClientSpecifier` to `HsClientNickname`.
* | | tor-persist: Make all Slugs non-empty.Gabriela Moldovan2024-01-315-26/+26
| | | | | | | | | | | | | | | | | | | | | | | | This also removes a TODO regarding adding a `Nickname` type for representing `HsClientSpecifier` and `HsNickname` (we don't need it if `Slug`s are non-empty). Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1931#note_2990227
* | | tor-keymgr: Add roundrip test for HsId -> Slug -> HsId conversion.Gabriela Moldovan2024-01-311-1/+22
| | | | | | | | | | | | This also fixes a bug in `HsId::from_component`.
* | | tor-keymgr: Allow empty denotators in ArtiPath (fmt).Gabriela Moldovan2024-01-311-8/+2
| | |
* | | tor-keymgr: Allow empty denotators in ArtiPath.Gabriela Moldovan2024-01-312-11/+7
| | |
* | | tor-hsservice: Fix corner case in HsNickname FromStr impl.Gabriela Moldovan2024-01-311-3/+19
| | | | | | | | | | | | | | | It was previously possible to construct an `HsNickname` out of an empty string using the `FromStr` impl.
* | | tor-persist: Forbid slugs from starting with a hyphen.Gabriela Moldovan2024-01-313-5/+44
| | |
* | | tor-keymgr: Add a TODO about removing ValidatedString.Gabriela Moldovan2024-01-311-0/+2
| | |
* | | tor-keymgr: Remove the Slug tests (fmt).Gabriela Moldovan2024-01-312-8/+3
| | |
* | | tor-keymgr: Remove the Slug tests.Gabriela Moldovan2024-01-311-34/+0
| | | | | | | | | | | | These tests belong in tor_persist now.
* | | tor-keymgr: Abolish ArtiPathComponent.Gabriela Moldovan2024-01-317-104/+57
| | | | | | | | | | | | | | | | | | `ArtiPathComponent`s are really just `Slugs`. Part of #1193, #1092
* | | tor-hsclient: Use Slug for HsClientSpecifier (fmt).Gabriela Moldovan2024-01-311-11/+3
| | |
* | | tor-hsclient: Use Slug for HsClientSpecifier.Gabriela Moldovan2024-01-312-4/+21
| | |
* | | tor-keymgr: Make ArtiPathComponent a Slug internally (fmt).Gabriela Moldovan2024-01-313-36/+57
| | |
* | | tor-keymgr: Make ArtiPathComponent a Slug internally.Gabriela Moldovan2024-01-313-104/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This will make it easier to replace `ArtiPathComponent` with `Slug` later down the line. Note this changes the syntax rules of `ArtiPathComponent`: * previously `ArtiPathComponent`s could be unicode strings, (now they are lowercase ASCII alphanumerics, plus `-`, `_`) * previously `ArtiPathComponent`s couldn't start with `-` or `_`, but now they can Part of #1193, #1092
* | | tor-keymgr: Strip .onion suffix from HsId before building Slug.Gabriela Moldovan2024-01-311-3/+28
| | | | | | | | | | | | | | | | | | We are about to replace `ArtiPathComponent` with `Slug`, but `Slug`s don't support `.`, so let's strip the `.onion` suffix before encoding it in the `ArtiPath`.
* | | tor-hsservice: Make Slug the underlying repr of HsNickname.Gabriela Moldovan2024-01-311-19/+24
| | | | | | | | | | | | | | | | | | | | | We represent `HsNickname` as a `Slug` instead of an `ArtiPathComponent` (we are about to remove the latter). Part of #1092
* | | tor_persist::slug: Allow hyphens in Slugs.Gabriela Moldovan2024-01-311-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | The internal representation of `HsNickname` will soon be `Slug`, and nicknames can contain hyphens, so let's add `-` to the allowed charset. Part of #1092
* | | Upgrade to strum 0.26Nick Mathewson2024-01-3010-10/+10
|/ /
* | Merge branch 'empty-slug' into 'main'Ian Jackson2024-01-291-0/+12
|\ \ | | | | | | | | | | | | slug: Provide BadSlug::EmptySlugNotAllowed See merge request tpo/core/arti!1933
| * | slug: Provide BadSlug::EmptySlugNotAllowedIan Jackson2024-01-291-0/+12
| | |
* | | fs_mistrust: Provide CheckedDir::make_secure_dirIan Jackson2024-01-292-0/+19
|/ / | | | | | | | | | | state_dir wants this, to descend into subdirectories. I think the implementation could be improved - see the TODO.
* | tor-hsservice: Downgrade a debug message to trace.Gabriela Moldovan2024-01-261-1/+4
| |
* | tor-hsservice: Abort any pending desc uploads if shutting down.Gabriela Moldovan2024-01-261-4/+46
| | | | | | | | | | | | | | | | `Reactor::upload_for_time_period` now exits as soon as the Reactor is dropped (its upload tasks check if `shutdown_tx` was dropped before proceeding). Closes #1253
* | tor-hsservice: Add an UploadError type for interruption due to shutdown.Gabriela Moldovan2024-01-261-0/+12
| | | | | | | | | | This error will be returned if an upload is aborted because the reactor shutting down.