summaryrefslogtreecommitdiff
path: root/crates/arti/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | arti cli: Do config watch setup before entering future selectIan Jackson2022-02-181-3/+3
|/ | | | IMO this clarifies things a bit, and makes things more deterministic.
* Merge branch 'remaining-errors'Nick Mathewson2022-02-171-1/+1
|\
| * Rename ExitTimeout to RemoteNetworkTimeout.Nick Mathewson2022-02-171-1/+1
| |
* | Fix compilation on mainNick Mathewson2022-02-171-1/+2
| |
* | arti: create TorClient first, then bootstrap.Nick Mathewson2022-02-151-4/+3
|/ | | | | | | | | | This change is possible now that #293 is done. As an immediate benefit, it allows us to start monitoring the configuration files immediately, and not only after we're done bootstrapping the client. Closes #336.
* Change deny(clippy::all) to warn(clippy::all).Nick Mathewson2022-02-141-1/+1
| | | | Closes #338.
* Merge branch 'eta/unbootstrapped-clients' into 'main'Nick Mathewson2022-02-111-1/+1
|\ | | | | | | | | | | | | Allow creating unbootstrapped `TorClient`s (and `DirMgr`s) Closes #293 See merge request tpo/core/arti!298
| * Allow creating unbootstrapped `TorClient`s (and `DirMgr`s)eta2022-02-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes how the `TorClient` type works, enabling it to be constructed synchronously without initiating the bootstrapping process. Daemon tasks are still started on construction (although some of them won't do anything if the client isn't bootstrapped). The old bootstrap() methods are now reimplemented in terms of the new create_unbootstrapped() and bootstrap_existing() methods. This required refactoring how the `DirMgr` works to enable the same sort of thing there. closes #293
* | Try to resolve the "Truncated" error in tor-socksprotoNick Mathewson2022-02-111-3/+3
|/ | | | | I'm not in love with this solution; the others just seem a bit ugly too.
* Make the Error detail type non-exported from arti-clientNick Mathewson2022-02-041-3/+3
| | | | | | | | | | | At least by default, we should have Error be private, and not expose it as part of our APIs. To keep functionality in `arti`, I had to add an `ExitTimeout` error kind. For interface consistency, I also re-exported ErrorKind and HasError from `arti_client`.
* Properly linkify two doc comment xrefs to issuesIan Jackson2022-02-041-2/+2
| | | | | | | | | | | | | | | | | | | | | Fixes these messages: warning: this URL is not a hyperlink --> crates/arti/src/watch_cfg.rs:115:5 | 115 | /// https://github.com/notify-rs/notify/issues/165 and | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://github.com/notify-rs/notify/issues/165>` | = note: `#[warn(rustdoc::bare_urls)]` on by default = note: bare URLs are not automatically turned into clickable links warning: this URL is not a hyperlink --> crates/arti/src/watch_cfg.rs:116:5 | 116 | /// https://github.com/notify-rs/notify/pull/166 . | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<https://github.com/notify-rs/notify/pull/166>` | = note: bare URLs are not automatically turned into clickable links
* Merge branch 'ticket270' into 'main'Nick Mathewson2022-02-032-13/+226
|\ | | | | | | | | | | | | Watch configuration files and reload them when they change Closes #270 See merge request tpo/core/arti!280
| * Document that `notify` behavior is strange with symlinksNick Mathewson2022-02-031-0/+5
| | | | | | | | | | | | | | | | | | | | (More specifically, `notify` behaves differently on different platforms. On some, it can watch specific directory objects on the filesystem, and so it only notices when _those_ directories change. If you change a symlink so that the canonical configuration file location is now in some other directory, `notify` won't notice. But on other platforms, notify just does "stat()" in a loop. On those, it _will_ notice if the configuration file changes.)
| * Avoid a potential infinite loop in configuration-watchingNick Mathewson2022-02-031-2/+5
| | | | | | | | | | | | | | | | | | | | | | Since the user can put their logfiles and configuration files in the same directory, writing to the log can trigger an event from `notify`. If we log every non-interesting event from `notify`, then we'll trigger the logs every time we log, and fill up the disk. This commit removes the offending log and adds a comment about why. If we someday decide we do need to log here, maybe we can rate-limit the messages or something.
| * Treat rescan events as meaning "reload configuration".Nick Mathewson2022-02-031-2/+2
| |
| * Add a couple of TODOs about configuration-watching.Nick Mathewson2022-02-021-0/+7
| |
| * Before reloading configuration, drain all pending file changesNick Mathewson2022-02-021-0/+8
| | | | | | | | | | This way, if there are a bunch of changes at once, we only reload one time.
| * Refactor file-watching code to watch parent directories.Nick Mathewson2022-02-021-8/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | Due to limitations in notify and the OS APIs it uses, it isn't actually so useful to watch a single file. Instead, we have to watch the directories that contain the files, and filter out any events that aren't about the specific files we care about. I've put the logic here into a new type, but I've left the type un-exported: its API is pretty ugly, inasmuch as the caller needs to jump through hoops to only get the events that they want. That's not too bad so long as the API is private, but we'd want better if we were exposing this.
| * arti: Limit mut-ness of cfg_sources to one block.Nick Mathewson2022-02-021-12/+16
| |
| * Detect changes in non-client configuration sections tooNick Mathewson2022-02-012-17/+30
| | | | | | | | We don't yet do much with these, but we can avoid discarding them.
| * Make configuration-watching configurable and off-by-default.Nick Mathewson2022-02-011-2/+11
| | | | | | | | | | | | | | | | I'm slightly concerned about whether this is behavior people would expect to have on-by-default, so let's make this off-by-default for now. Maybe the `application` and `system` sections should merge?
| * Reload configuration when our configuration files change.Nick Mathewson2022-02-012-1/+68
| | | | | | | | Closes #270
* | Merge branch 'typos' into 'main'eta2022-02-031-1/+1
|\ \ | | | | | | | | | | | | Fix typos See merge request tpo/core/arti!285
| * | Fix typosDimitris Apostolou2022-02-021-1/+1
| |/
* / Remove many needless borrows and slicesIan Jackson2022-02-021-2/+2
|/ | | | | | | Found via clippy::needless_borrow. In some cases I removed needless `[..]` too. See also: needless_borrow suggestion doesn't go far enough https://github.com/rust-lang/rust-clippy/issues/8389
* Un-Arc<> TorClient in the arti crateNick Mathewson2022-02-012-8/+5
| | | | | TorClient doesn't need to be wrapped in an Arc any longer, thanks to other refactoring.
* arti_config: Refactor configuration sources into a structNick Mathewson2022-02-011-19/+24
| | | | | | | | | | | | | | | | | | | This is by no means our final API, but should represent an improvement. Here instead of having to specify a list of files and their is-this-optional status, along with a list of command-line options, we have a single structure that encapsulates all of that information. Two advantages here: - Callers no longer have to remember what the boolean means. - We can "reload" more easily, by keeping the source object around. This change also implements the correct behavior for our default configuration file in `arti::main`: if the file is absent and the user doesn't list a config file, that's no problem. But if the user lists _that very same config file, we should insist that it be present.
* Make max_file_limit configurableNeel Chauhan2022-01-282-12/+5
|
* arti: be more careful to use the user-selected runtimeNick Mathewson2022-01-261-4/+11
|
* Rename `SpawnBlocking` trait to `BlockOn`.Nick Mathewson2022-01-261-1/+1
| | | | | This avoids a future confusion with the new `SpawnBlocking` trait in async_executors v0.5, and better describes what the trait provides.
* Make the native-tls crate optional.Nick Mathewson2022-01-261-2/+2
| | | | | | | | | | | This commit puts the native-tls crate behind a feature. The feature is off-by-default in the tor-rtcompat crate, but can be enabled either from arti or arti-client. There is an included script that I used to test that tor-rtcompat could build and run its tests with all subsets of its features. Closes #300
* Make current/create functions into runtime member functions.Nick Mathewson2022-01-261-3/+5
| | | | | This should help avoid some amount of temptation towards API proliferation.
* StreamPrefs: Re-alphabetise imports following renameIan Jackson2022-01-211-1/+1
| | | | Placates rustfmt
* StreamPrefs: rename from ConnectPrefsIan Jackson2022-01-211-3/+3
| | | | | | | | | | | | | The docs even say this is about stream. As @nickm writes in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/252#note_2771289 we generally call end-to-end connections that are tunneled over Tor "Streams" to distinguish them from everything else in the Tor protocols that could possibly be called a "Connection". That seems to apply here too.
* connection preferences: Take ConnectPrefs by referenceIan Jackson2022-01-191-3/+3
| | | | | This may save quite a bit of copying. The callees don't need to copy the whole struct; they copy the bits they need.
* Apply suggestions to better describe the purpose of LogGuards.Ian Jackson2022-01-101-4/+5
|
* Tracing configuration for logfiles, per-target filtersNick Mathewson2022-01-102-36/+141
| | | | | | | | | | | | | | | | | | | | | | | | | | | Previously we could only configure one global tracing filter that applied to stdout and journald. There was no support for log files, either. This patch fixes both issues, by substantially revising the configuration format: There are now separate filters for each log file, for journald, and for the console log. Because we want to allow multiple logfiles, they have to go into an array in the configuration. The configuration logic has grown a bit complicated in its types, since the tracing_subscriber crate would prefer to have the complete structure of tracing Layers known statically. That's fine when you know how many you have, and which kinds there will be, but for the runtime-configuration case we need to mess around with `Box<dyn Layer ...>`. I also had to switch from tracing_subscriber's EnvFilter to its Targets filter. It seems "EnvFilter" can only be applied as a Layer in itself, and won't work as a Filter on an individual Layer. Closes #166. Closes #170.
* Move tracing setup into a separate module.Nick Mathewson2022-01-102-43/+49
| | | | No code changes here yet.
* Use *_with_prefs() for Option<ConnectPrefs> callers in TorClient::connectNeel Chauhan2022-01-081-3/+5
|
* Move a comment to the right place.Nick Mathewson2022-01-061-4/+2
|
* extend lints to include 'clippy::all'Daniel Eades2021-12-281-2/+4
|
* proxy: introduce new functions to write_all & flush/closeMuhammad Falak R Wani2021-12-151-42/+42
| | | | Signed-off-by: Muhammad Falak R Wani <[email protected]>
* proxy: send SOCKS5 reply on failure casesMuhammad Falak R Wani2021-12-111-1/+14
| | | | Signed-off-by: Muhammad Falak R Wani <[email protected]>
* proxy: report an error if all listeners fail.Nick Mathewson2021-12-081-1/+1
|
* Resolve XXXXs in proxy.rsNick Mathewson2021-12-081-3/+3
| | | | These issues all have tickets, so can become TODOs.
* add semicolons if nothing returnedDaniel Eades2021-11-251-0/+1
|
* More typo fixes that I forgot to save :(Nick Mathewson2021-11-241-1/+1
|
* Fix a few typos.Nick Mathewson2021-11-241-1/+1
| | | | Also fix some commonwealth spellings that had slipped in.
* Move the socks_port option into a new proxy section.Nick Mathewson2021-11-181-1/+4
| | | | Now there are no options that aren't in a toml section.
* Move top-level configuration downwards from `arti` to `arti-config`.Nick Mathewson2021-11-182-264/+11
| | | | | | | | To do this at all neatly, I had to split out `tor-config` from `arti-config` again, and putting the lower level stuff (paths, builder errors) into tor-config. I also changed our use of derive_builder to always use a common error type, to avoid error type proliferation.