summaryrefslogtreecommitdiff
path: root/crates/arti-client/src/client.rs
Commit message (Collapse)AuthorAgeFilesLines
* Update arti-client to new NetDirProvider API.Nick Mathewson2022-07-261-6/+20
| | | | | | This allows us to give better errors in the case where bootstrapping succeeds at first, but fails thereafter for long enough to make our directory expire.
* arti-client: Split "Persist" into setup and access variants.Nick Mathewson2022-07-211-2/+8
|
* arti_client: turn "Proto" error into StreamFailed.Nick Mathewson2022-07-211-3/+12
|
* arti_client: Split DirMgr error into useful types.Nick Mathewson2022-07-211-1/+4
|
* arti-client: Remove code related to overriding fs-mistrust.Nick Mathewson2022-07-191-12/+6
| | | | | | | | This logic can now be adjusted via the config object so that it does its own overriding by looking at the environment as appropriate. Removing these methods helps simplify the code a bit. Enabled by #483.
* arti-client: Do periodic task dormancy in a management taskIan Jackson2022-07-181-37/+28
| | | | | This means that it is no longer possible to write code which updates the dormant mode but forgets to notify the periodic tasks.
* arti-client: Make dormant_mode be an Option, None on dropIan Jackson2022-07-181-13/+27
| | | | | This will allow receivers (which we are about to introduce) to terminate when the last client is dropped.
* arti-client: Convert dormant_mode into a postage::watchIan Jackson2022-07-181-17/+34
| | | | | | | | We are going to want to be able to wake up other tasks elsewhere in Arti, that need to know about dormancy. We will give them a postage watch Receiver. Right now there are no such things yet.
* arti-client: Make DormantMode have a DefaultIan Jackson2022-07-181-1/+3
|
* channel padding: Plumb settings from chanmgrIan Jackson2022-06-211-1/+1
|
* Merge branch 'dormant_directory' into 'main'Nick Mathewson2022-06-131-0/+1
|\ | | | | | | | | | | | | Use TaskSchedule to sleep in directory bootstrapping Closes #497 See merge request tpo/core/arti!571
| * New API to expose and use TaskHandle from DirMgr.Nick Mathewson2022-06-131-0/+1
| | | | | | | | | | | | This change also means that we need to create the handle and scheduler earlier in the process of creating the DirMgr. If we don't, we won't have a way to manage the task before bootstrap() returns.
* | Move responsibility for GuardMgr NetDir updates to GuardMgr.Nick Mathewson2022-06-071-7/+0
| | | | | | | | | | | | | | | | | | | | | | Previously it was the job of a task in CircMgr to do this; but we're going to want to give GuardMgr full access to the latest NetDir for this, and for other code-simplification reasons. With this change I'm deprecating a couple of functions in tor-circmgr. It's no longer necessary for us to have an artificial external way for you to feed new NetDirs to a circmgr. (I could just remove them, but I want practice deprecating.)
* | Remove now-redundant Send+Sync constraints alongside NetDirProviderNick Mathewson2022-06-071-2/+2
|/
* Make fs-mistrust configurable from the top level.Nick Mathewson2022-05-241-1/+2
| | | | | | This change requires a little refactoring of TorClientBuilder: now, instead of enabling or disabling mistrust, it enables or disables the decision to _override_ the mistrust in the config.
* add unit tests for arti_client::StreamPrefsmichael mccune2022-05-231-0/+77
| | | | | | this change adds unit tests for the public methods of StreamPrefs. although these are mostly "setter" style functions, the tests confirm the basic expectations and operation.
* Merge branch 'use-fs-mistrust'Nick Mathewson2022-05-091-3/+11
|\
| * arti-client: Configure and use fs-mistrust.Nick Mathewson2022-05-091-3/+11
| | | | | | | | | | | | This is derived from the environment, not the configuration file: We might not want to trust the configuration file until we've decided whether we like its permissions.
* | Apply `sensitive` in some info-level log messages.Nick Mathewson2022-05-061-1/+2
|/ | | | | This specifically applies the `sensitive` wrapper in the places where we're logging target addresses at level "info" or higher.
* Fix spacingSamanta Navarro2022-04-271-1/+1
|
* squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-251-1/+0
| | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* arti-client: Report clock skew when it is noteworthyNick Mathewson2022-04-121-0/+2
| | | | | (Also, blame clock skew when it is an explanation of why we cannot finish a connection.)
* Make daemon tasks self-contained; introduce NetDirProvidereta2022-03-301-261/+14
| | | | | | | | | | | | | | | The various background daemon tasks that `arti-client` used to spawn are now handled inside their respective crates instead, with functions provided to spawn them that return `TaskHandle`s. This required introducing a new trait, `NetDirProvider`, which steals some functionality from the `DirProvider` trait to enable `tor-circmgr` to depend on it (`tor-circmgr` is a dependency of `tor-dirmgr`, so it can't depend on `DirProvider` directly). While we're at it, we also make some of the tasks wait for events from the `NetDirProvider` instead of sleeping, slightly increasing efficiency.
* Merge branch 'isolation-followup' into 'main'Nick Mathewson2022-03-281-12/+12
|\ | | | | | | | | implement IsolationHelper for StreamIsolation See merge request tpo/core/arti!434
| * remove usage of 'token' where it's no longer a tokentrinity-1686a2022-03-271-3/+3
| |
| * move StreamIsolation to isolation moduletrinity-1686a2022-03-241-1/+1
| |
| * rename *_isolation_group to *_isolationtrinity-1686a2022-03-241-8/+8
| |
* | Merge branch 'dir-filter' into 'main'Ian Jackson2022-03-251-1/+6
|\ \ | | | | | | | | | | | | arti-client, dirmgr: Initial DirFilter code See merge request tpo/core/arti!431
| * | Expose DirFilter from arti-client.Nick Mathewson2022-03-241-1/+6
| |/ | | | | | | | | This will make it possible to implement a directory-munging mechanism in arti-testing for #397.
* / Implement a periodic task scheduler, and a basic dormant modeeta2022-03-231-35/+111
|/ | | | | | | | | | | This is a revised version of !397; it implements a scheduling system for periodic tasks that can be externally controlled, and then uses the external control aspect to implement a basic dormant mode (#90). More technically, the scheduling system consists of a `Stream` that periodic tasks are expected to embed in a `while` loop or similar, a way for tasks themselves to choose how long to wait until the stream next yields a result, and a handle to control this outside of the task.
* Alternative API for set_isolation_group().Nick Mathewson2022-03-171-2/+5
| | | | | | | | | | | | Instead of requiring a `Box<dyn Isolation>`, it now takes either a `Box<dyn Isolation>`, or an arbitrary `T` that implements `Isolation`. This API still allows the user to pass in a `Box<dyn Isolation>` if that's what they have, but it doesn't require them to Box the isolation on their own. Part of #414.
* Merge branch 'test-isolation' into 'main'Nick Mathewson2022-03-171-17/+18
|\ | | | | | | | | new api for isolation See merge request tpo/core/arti!377
| * replace TODOs with documentationtrinity-1686a2022-03-161-2/+1
| |
| * accept boxed isolation in StreamPref::set_isolation_grouptrinity-1686a2022-03-161-2/+2
| |
| * add tests on Isolation and fix conditional compilation issuestrinity-1686a2022-03-161-1/+0
| | | | | | | | | | | | it seems I added conditional compilation without noticing it?? and there was some errors when choosing a prefered runtime depending on feature flags
| * replace Arc with Box and use dyn-clonetrinity-1686a2022-03-161-52/+37
| | | | | | | | this also removes JoinResult
| * replace result with eithertrinity-1686a2022-03-161-5/+6
| |
| * testing new api for isolationTrinity Pointard2022-03-161-36/+53
| |
* | DirMgrConfig: abolish builder; make it transparent and exhaustiveIan Jackson2022-03-161-2/+2
| | | | | | | | See rationale in the comment.
* | Make CircMgrConfig transparent (and make it a trait)Ian Jackson2022-03-161-5/+5
|/ | | | See commentary for the rationale.
* actually add DNS supporttrinity-1686a2022-03-141-1/+1
|
* Merge branch 'educe-traits' into 'main'Ian Jackson2022-03-041-14/+7
|\ | | | | | | | | Replace many manual trait impls with use of educe See merge request tpo/core/arti!375
| * Replace manual Default impls on enums with educe in arti-clientIan Jackson2022-03-021-14/+7
| |
* | arti-client: Make dirmgr() and circmgr() return &Arc<..>Nick Mathewson2022-03-031-4/+4
| | | | | | | | | | | | | | | | | | | | | | Previously they returned an Arc, which wasn't necessary unless the client actually _wanted_ a new Arc. This would be an API break, except that these functions are marked 'experimental-api', so semver does not apply; nonetheless I've noted the break in semver_status.md, just in case we care. Closes #369
* | Merge branch 'dir-provider-redux' into 'main'Ian Jackson2022-03-021-17/+21
|\ \ | |/ |/| | | | | Alternative DirProvider setup See merge request tpo/core/arti!347
| * Add a builder function for replacing a DirProvider.Nick Mathewson2022-02-231-12/+12
| | | | | | | | Put it behind experimental_api.
| * Un-parameterize DirProvider.Nick Mathewson2022-02-231-5/+3
| | | | | | | | | | | | | | | | | | | | This patch removes the EventStream associated type and the Runtime parameter. The Runtime parameter wasn't actually used for anything, and the EventStream was easy enough to replace with a BoxStream in this case. Also replaced DirBootstrapEvents with a BoxStream to avoid tying anything to our backend.
| * Add basic DirProvider trait, use it in clientChristian Grigis2022-02-231-6/+12
| |
* | arti-client: use PreferredRuntime by default, doc cleanupseta2022-02-281-49/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes using the `PreferredRuntime` the first-class option inside `arti-client`, freeing users who don't want to think about runtimes from having to do so. `TorClient::create_unbootstrapped` and `builder` now automatically use this runtime, leaving only `builder_custom` for users who wish to manually specify a runtime. This lets us clean up the docs a lot: mentions of using custom runtimes are now relegated to nearer the end of the crate-level documentation, and we mostly just link to `tor_rtcompat`'s docs to explain more there. Instead, we take some more time to explain how you use the builder API to create clients synchronously. Other doc cleanups included getting rid of the explanation of `TorAddr` in the main crate-level doc; this is already well-documented elsewhere, and is something users should discover organically later. fixes arti#326
* | Merge branch 'get-runtime' into 'main'Ian Jackson2022-02-251-0/+11
|\ \ | | | | | | | | | | | | TorClient: Add get_runtime() convenience method See merge request tpo/core/arti!350