summaryrefslogtreecommitdiff
path: root/crates/tor-config/src
Commit message (Collapse)AuthorAgeFilesLines
* tor-config: removed re-export of `CfgPath`Steven Engler2024-11-041-1/+0
| | | | | Also updated other packages to get `CfgPath` directly from `tor-config-path' instead of 'tor-config'.
* tor-config-path: moved `tor_config::path` to hereSteven Engler2024-10-292-506/+1
| | | | This is a direct move of the `path` module from tor-config.
* tor-config: remove `CfgPathError::BadUtf8`Steven Engler2024-10-281-20/+1
|
* tor-config: use 'path' feature of shellexpandSteven Engler2024-10-281-40/+15
|
* tor-config: Document the limitations of the FileWatcher.Gabriela Moldovan2024-10-161-0/+9
|
* tor-config: Compare the file contents when testing.Gabriela Moldovan2024-10-161-0/+7
| | | | | | | When testing, compare the contents of the files too, not just their mtime Otherwise, because the polling backend detects changes based on mtime, if the test creates/writes files too fast, it will fail to notice changes (this can happen, for example, on a tmpfs).
* tor-config: Configure the polling interval.Gabriela Moldovan2024-10-161-2/+17
| | | | | | | | | The default is 30s, which feels a bit too long. Also, when testing, we use a much shorter interval. This is meant to be a temporary solution, so we hard-code the interval rather than make it configurable.
* tor-config: Use a polling watcher on non-windows platforms that don't have ↵Gabriela Moldovan2024-10-161-2/+9
| | | | | | | | | | | | | | | inotify. On windows and platforms that support inotify (i.e. linux and android), we continue using the recommended watcher. On platforms that use kqueue, we switch to a polling watcher to work around a [notify bug] that manifests when using a non-recursive watcher to watch a directory. This commit is best reviewed with `git diff --ignore-all-space`. Closes #1644 [notify bug]: https://github.com/notify-rs/notify/issues/644
* tor-config: Add a type alias for the underlying watcher (fmt).Gabriela Moldovan2024-10-161-2/+2
|
* tor-config: Add a type alias for the underlying watcher.Gabriela Moldovan2024-10-161-3/+6
| | | | | This type will soon become platform-dependent, so I am preemptively adding a type alias.
* tor-config: Expose assert_config_error test helper.Gabriela Moldovan2024-10-082-0/+19
| | | | | | This moves the `assert_config_error` helper from the restricted discovery config tests to a `testing` module in `tor-config` (I am about to reuse it for the C Tor keystore config tests too).
* tor-config: Add Listen::is_localhost_only.Nick Mathewson2024-09-251-0/+33
|
* tor-config: move Listen to its own module.Nick Mathewson2024-09-253-377/+402
|
* Fix typosDimitris Apostolou2024-09-031-1/+1
|
* tor-config: Improve FileWatcher documentation.Gabriela Moldovan2024-08-281-1/+12
|
* tor-config: Add tests for FileWatcher::watch_path.Gabriela Moldovan2024-08-281-0/+73
|
* tor-config: Make a test helper take a reference to TempTestDir.Gabriela Moldovan2024-08-281-2/+2
|
* tor-config: Rename watch_file to watch_path.Gabriela Moldovan2024-08-271-3/+3
| | | | `FileWatcher::watch_file` can be used with arbitrary paths.
* tor-config: Write tests for FileWatcher.Gabriela Moldovan2024-08-211-3/+142
|
* tor-config: Add a TODO about relocating file_watcher.Gabriela Moldovan2024-08-211-0/+3
|
* tor-config: Add getters for FileWatcher.Gabriela Moldovan2024-08-211-1/+9
| | | | | | | Sometimes it's useful to know what files/directories are being watched. For example, the descriptor publisher needs to know in order to figure out if it needs to update the watcher in response to changes in the config.
* tor-config: Support watching dirs for files with a given extension (fmt).Gabriela Moldovan2024-08-211-2/+9
|
* tor-config: Support watching dirs for files with a given extension.Gabriela Moldovan2024-08-211-19/+72
| | | | | | | | | | | | | | This also fixes a couple of issues with the previous implementation: * it enables you to watch for more than just one file/extension per directory (each directory now has a list of filters. If any of the filters apply to the path contained in the notify::Event, the `FilterWatcher` notifies the listeners * it removes the list watched files from `FileWatcher`. This makes things a lot simpler to grok: essentially, the file watcher only ever watches directories, notifying if an "interesting" file was changed (in our case, the interesting files are files that have a relevant extension, such as `.auth`, or specific configuration files, as specified by `ConfigurationSources`).
* tor-config: Move event handling to a separate function.Gabriela Moldovan2024-08-211-20/+30
| | | | | This will soon grow more complex, so I am preemptively moving it out of `start_watching`.
* tor-config: Remove unused Event::SigHup variant.Gabriela Moldovan2024-08-211-3/+0
| | | | | We don't need this variant anymore, because sighup is now handled separately from `FileWatcher` events.
* tor-config: Make FileWatcher use an opaque channel type.Gabriela Moldovan2024-08-211-5/+68
| | | | The `FileWatcher` now uses a `postage::watch` channel under the hood.
* tor-config: Give FileWatcherBuilder a handle to the runtime.Gabriela Moldovan2024-08-211-11/+10
| | | | | The event handler will soon be made async, so we need a handle to the runtime.
* tor-config: Move FileWatcher to tor-config.Gabriela Moldovan2024-08-212-0/+196
| | | | | | | | | For the most part, this is just code motion. The only change here is that `prepare` is no longer a method on `FileWatcher`. This decouples `FileWatcher` from `ConfigurationSources`, enabling us to use it to watch files and directories that aren't configuration.
* arti-client: Move BuilderExt to tor-config.Gabriela Moldovan2024-08-052-0/+32
| | | | | `BuilderExt` will soon be used in tor-hsservice too (for configuring the mistrust settings of the client "restricted mode" authorization keys).
* tor-config: Deprecate ConfigError::Permissions, use FileAccessIan Jackson2024-07-102-1/+6
|
* tor-config: Correct message and description for mistrust errorIan Jackson2024-07-101-2/+4
| | | | Part of #1473
* Change deftly syntax to post 0.12.1 versionIan Jackson2024-06-172-2/+2
| | | | | | | | | | | * Change `pub` to `export` * Change the `=` in define to `:` * Change `pub_template_semver_check` to `template_export_semver_check` Right now, 0.12.1 supports both syntaxes. I have verified this branch also compiles with https://gitlab.torproject.org/Diziet/rust-derive-deftly/-/merge_requests/402 ee171ffaf56d7dcb7d75584054921153fe19b222
* Update to derive-deftly 0.12.1Ian Jackson2024-06-171-1/+1
| | | | | | * Bump in Cargo.toml * Deal with `${Xmeta as ...}` incompatible change, by always specifying an `as`, and changing `as tokens`.
* tor-config: Move macro above ExplicitOrAuto definition.Gabriela Moldovan2024-06-031-58/+58
| | | | | | | The macro needs to be defined before `ExplicitOrAuto`, otherwise we can't reference it in its docs. Fixes the broken doc links.
* tor-config: Apply deferred cargo fmt.Gabriela Moldovan2024-06-031-27/+26
|
* tor-config: Cross-reference NotAutoValue in the ExplicitOrAuto docs.Gabriela Moldovan2024-06-031-0/+5
|
* tor-config: Fix a test misusing NotAutoValue.Gabriela Moldovan2024-06-031-15/+11
|
* tor-config: Add macro for implementing NotAutoValue.Gabriela Moldovan2024-06-031-0/+79
|
* tor-config: Re-export serde_value.Gabriela Moldovan2024-06-031-0/+1
| | | | | We are about to need this in other crates (for generating the tests for the `NotAutoValue` implementations).
* tor-config: Add NotAutoValue trait bound to ExplicitOrAuto inner type.Gabriela Moldovan2024-06-031-2/+7
| | | | | | | This is a safeguard to prevent users from using ExplicitOrAuto with types that serialize to the same value as ExplicitOrAuto::Auto. Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2146#note_3030692
* tor-config: Add ExplicitOrAuto::{as_value, into_value}.Gabriela Moldovan2024-06-031-0/+30
|
* tor-config: Remove unnecessary bounds.Gabriela Moldovan2024-06-031-6/+1
|
* tor-config: Expand on the ExplicitOrAuto docs.Gabriela Moldovan2024-06-031-0/+52
|
* tor-config: Add ExplicitOrAuto helper.Gabriela Moldovan2024-06-031-2/+97
| | | | | | | | This will be used for the `vanguard.mode` config option. The `VanguardMode` corresponding to the `"auto"` variant will depend on whether the `vanguards` feature is enabled: if the feature is enabled, it is mapped to `VanguardMode::Lite`, and `VanguardMode::Disabled` otherwise.
* doc: Use locked buildpinkforest2024-05-161-1/+1
|
* Re-run maint/add_warning.Nick Mathewson2024-05-061-2/+2
| | | | This commit is automatically generated.
* Resolve some clippy warnings about empty rustdoc.Nick Mathewson2024-05-051-1/+1
| | | | | (In most cases, by writing the documentation; in tests, by permitting the documentation to be missing.)
* Switch to figment 1.0.18 and extract_lossyNick Mathewson2024-04-222-3/+3
| | | | | | | The new (dubiously named) `Figment::extract_lossy` method can treat decode numbers from strings, and booleans from numbers or strings. This makes the behavior compatible with config-rs, and should (I hope) finally allow us to migrate.
* Rename ConfigParseError => ConfigLoadErrorNick Mathewson2024-04-221-8/+15
| | | | | Figment can give an error under more conditions than just a parsing failure, so we should report it a bit more vaguely.
* Add an action field to Io error in tor-config.Nick Mathewson2024-04-222-15/+24
|