summaryrefslogtreecommitdiff
path: root/crates/tor-config/src
Commit message (Collapse)AuthorAgeFilesLines
* file_watcher: Remove some now-unused thingsIan Jackson2025-02-061-8/+10
|
* file_watcher: Use .borrow_mut and sync MutexIan Jackson2025-02-061-10/+4
|
* file_watcher: Add some commentary about Event semanticsIan Jackson2025-02-061-0/+10
|
* tor-config: Improve mistrust documentationClara Engler2025-01-231-0/+12
| | | | | | | | This commit improves the documentation for `ConfigurationSources::set_mistrust`, by explaining that this option is unrelated to the paths defined within the configuration file itself, referring to the `storage.permissions.dangerously_trust_everyone` option.
* tor-config: Test that uninteresting events get ignored.Gabriela Moldovan2025-01-091-3/+21
|
* tor-config: Rewrite match for readability.Gabriela Moldovan2025-01-091-3/+5
| | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2696#note_3145971
* tor-config: Avoid using EventKind::Any in the tests.Gabriela Moldovan2025-01-091-3/+4
| | | | Events of type `Any` now get discarded by the event handler.
* tor-config: Handle rescan events before filtering.Gabriela Moldovan2025-01-091-3/+2
| | | | | This enables us to catch "rescan" events, regardless of their underlying `EventKind`.
* tor-config: Make the `FileWatcher` ignore non-mutating file events.Gabriela Moldovan2025-01-091-1/+13
| | | | | | | | Without this, setting `watch_configuration = true` results in endless config reloading due to arti accessing the config (which triggers an access event, which in turn, triggers a config reload, and so on). Closes #1794
* clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* map_builder: Document deserialize implemntation.Nick Mathewson2024-12-191-0/+3
|
* ExtendBuilder: Try to document more clearly what it doesNick Mathewson2024-12-191-0/+4
|
* map_builder: Extensively rework example.Nick Mathewson2024-12-191-9/+64
|
* extend_builder: document more about why it works.Nick Mathewson2024-12-191-0/+33
|
* extend_builder: Tests for strip_option, default.Nick Mathewson2024-12-191-0/+206
|
* map_builder: Add support for default settings.Nick Mathewson2024-12-191-10/+133
| | | | | | This is a little tricky (beyond the usual macro fun) because we needed to use ExtendBuilder to get reasonable behavior for our default trees.
* Define macros to create a map-builder type.Nick Mathewson2024-12-192-0/+216
| | | | | | | | | | | | We're about to need this to define some of the configuration for RPC listeners. The provided map-builder type is much less voluminous in terms of APIs added than the list-builder type: It just uses Deref* and sub_builder. I think this simplicity may be a win. I'll need to rethink how this type handles defaults in order to implement connect points properly; I've left XXXXs for that issue.
* tor-config: Add "extend" functionality for config builders.Nick Mathewson2024-12-192-0/+180
| | | | We'll use this to implement defaults for maps in our configuration.
* list_builder: fix a very typoed line.Nick Mathewson2024-12-191-1/+1
|
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* 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
|