summaryrefslogtreecommitdiff
path: root/crates/arti-client/src
Commit message (Collapse)AuthorAgeFilesLines
...
* arti-client, keymgr: Initialize KeyMgr with an ArtiNativeKeyStore.Gabriela Moldovan2023-06-151-2/+16
| | | | | | | The `KeyMgr` is now initialized with an `ArtiNativeKeyStore` built from an invalid key store root dir (this is alright for the purposes of this proof-of-concept, since `ArtiNativeKeyStore::new` won't fail as it doesn't currently validate the keystore root dir).
* keymgr: Introduce ToEncodableKey to simplify lookups.Gabriela Moldovan2023-06-151-7/+6
| | | | | | | This means `KeyMgr` users don't need to specify the underlying key type (e.g. `ed25519::Keypair`) when retrieving keys. Instead, they can just specify the type required (as long as it implements `ToEncodableKey`), e.g. `HsClientIntroAuthKeypair`.
* arti-client: Make the client use the KeyMgr.Gabriela Moldovan2023-06-152-3/+82
| | | | | `TorClient` now uses a `KeyMgr` to retrieve the `HsClientSecretKeys` client auth keys passed to `get_or_launch_connection`.
* Merge branch 'rpc_pseudomethods_v6' into 'main'Nick Mathewson2023-06-121-5/+7
|\ | | | | | | | | RPC: Functionality to downcast dyn Object to a dyn Trait. See merge request tpo/core/arti!1225
| * RPC: Functionality to downcast dyn Object to a dyn Trait.Nick Mathewson2023-06-121-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a rather tricky piece of functionality. It works as follows. We introduce a `CastTable` type. Each `CastTable` tells us how to downcast `dyn Object` for objects of a single concrete type. The `Object` type now has a `get_casttable` method that returns an empty `CastTable` by default. `CastTable` is, internally, a map from the `TypeId` of the target dyn Trait reference type to a function `fn(&dyn Object) -> &dyn Trait`. These functions are stored as `Box<dyn Any + ...>`. (They are Boxed because they may refer to generic functions, which you can't get a static reference to, and they're Any because the functions have different types.) The `decl_object!` macro now implements `get_casttable` as appropriate. (The syntax is a bit janky, but that's what we get for not using derive_adhoc.) For non-generic types, `get_casttable` uses a Lazy<CastTable>`. to initialize a CastTable exactly once. For generic types, it use a `Lazy<RwLock<HashMap<..>>` to build one CastTable per instantiation of the generic type. This could probably be optimized a bit more, the yaks could be shaved in a more scintillating hairstyle, and the syntax for generic `decl_object` could definitely be improved.
| * rpc: make decl_object! responsible for writing impl Object {} blocks.Nick Mathewson2023-06-071-1/+1
| |
* | Merge branch 'pt-snowflake' into 'main'Nick Mathewson2023-06-111-2/+7
|\ \ | | | | | | | | | | | | | | | | | | add documentation for configuring snowflake pt Closes #879 and #875 See merge request tpo/core/arti!1216
| * | add a few more comments on PTstrinity-1686a2023-06-091-0/+2
| | |
| * | complement general documentation on bridges and pttrinity-1686a2023-06-071-0/+2
| | |
| * | move snowflake example to dedicated file and comment it moretrinity-1686a2023-06-071-27/+5
| | |
| * | add documentation for configuring snowflake pttrinity-1686a2023-06-071-4/+27
| |/
* / hs: Fix a feature name in arti-clientNick Mathewson2023-06-071-1/+1
|/ | | | In arti-client it's called "onion-client", not "hs-client".
* Refactor ClientCirc APIs to use Arc<ClientCirc>.Nick Mathewson2023-05-161-1/+1
| | | | | | | | | | | | Now ClientCirc is no longer `Clone`, and the things that need it to be `Clone` instead return and use an Arc<ClientCirc> We're doing this so that ClientCirc can participate in the RPC system, and so that its semantics are more obvious. Closes #846. Thanks to the type system, this was a much simpler refactoring than I had feared it would be.
* RPC: Start on plumbing TorClient into our RPC codeNick Mathewson2023-05-042-0/+19
| | | | | Because of #837, we won't be able to work with _every_ TorClient<R>, so I'm only going to be using TorClient<PreferredRuntime> for now.
* arti-client: Only run BridgesConfig doc test if pt-client feature is enabled.Gabriela Moldovan2023-05-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | One of the tests run as part of `cargo test -p arti-client` fails because the `pt-client` feature is not enabled by default: ``` failures: ---- src/config.rs - config::BridgesConfig (line 221) stdout ---- error[E0432]: unresolved import `arti_client::config::pt` --> src/config.rs:225:26 | 7 | use arti_client::config::pt::ManagedTransportConfigBuilder; | ^^ could not find `pt` in `config` error[E0599]: no method named `bridges` found for mutable reference `&mut BridgesConfigBuilder` in the current scope --> src/config.rs:233:19 | 15 | builder.bridges().bridges().push(bridge_1); | ^^^^^^^ private field, not a method error[E0599]: no function or associated item named `default` found for struct `BridgeConfigBuilder` in the current scope --> src/config.rs:236:48 | 18 | let mut bridge2_builder = BridgeConfigBuilder::default(); | ^^^^^^^ function or associated item not found in `BridgeConfigBuilder` error[E0599]: no method named `bridges` found for mutable reference `&mut BridgesConfigBuilder` in the current scope --> src/config.rs:247:19 | 29 | builder.bridges().bridges().push(bridge2_builder); | ^^^^^^^ private field, not a method error[E0599]: no method named `transports` found for mutable reference `&mut BridgesConfigBuilder` in the current scope --> src/config.rs:255:19 | 37 | builder.bridges().transports().push(transport); | ^^^^^^^^^^ method not found in `&mut BridgesConfigBuilder` error: aborting due to 5 previous errors Some errors have detailed explanations: E0432, E0599. For more information about an error, try `rustc --explain E0432`. Couldn't compile the test. failures: src/config.rs - config::BridgesConfig (line 221) test result: FAILED. 5 passed; 1 failed; 3 ignored; 0 measured; 0 filtered out; finished in 2.10s ``` This disables the `BridgesConfig` doc test if the `pt-client` feature is not enabled. Closes #843 Signed-off-by: Gabriela Moldovan <[email protected]>
* Merge branch 'plumb' into 'main'Alexander Færøy2023-03-302-7/+17
|\ | | | | | | | | More plumbing for hs connections See merge request tpo/core/arti!1098
| * Run rustfmtIan Jackson2023-03-301-8/+4
| | | | | | | | Apply this churn, which I deferred for ease of review.
| * arti-client: Call HsCircPool::launch_background_tasksIan Jackson2023-03-301-4/+13
| | | | | | | | | | | | | | | | I found that I had the bug where I forgot to call this function, and reached bad_api_usage!("The circuit launcher wasn't initialized") The possibility of such a bug is a hazard of this API pattern.
| * tor-hsconn: Rename ConnError (from HsClientConnError)Ian Jackson2023-03-301-2/+2
| | | | | | | | | | The old name was unwieldy and other crates can just as well name it by the crate scope.
| * arti-client: When making hs conn, wait for bootstrapIan Jackson2023-03-301-0/+3
| | | | | | | | | | Not doing this was a bug. The bug was possible because of some code duplication between the exit and hs paths. Add a comment about that.
| * tor-client: Pass a netdir for each requestIan Jackson2023-03-301-1/+3
| | | | | | | | | | This will be more convenient inside tor-hsclient. In arti-client, this mirrors the way TorClient::get_or_launch_exit_circ works.
* | Move functionality from tor_basic_utils to tor_async_utilsNick Mathewson2023-03-291-1/+1
|/ | | | | This commit is mostly code movement; I'd recommend reviewing it with git's `--color-moved` option.
* Merge branch 'hspre' into 'main'Ian Jackson2023-03-292-4/+9
|\ | | | | | | | | Miscellanious tidying up (pursuant to HS client work) See merge request tpo/core/arti!1086
| * Tidy up an unused import warningIan Jackson2023-03-281-1/+3
| | | | | | | | | | | | Now cargo +stable clippy --locked --offline --workspace --all-targets is clean.
| * Pass HsCircPool to hsclient connect function, not CircMgr (fmt)Ian Jackson2023-03-281-5/+5
| |
| * Pass HsCircPool to hsclient connect function, not CircMgrIan Jackson2023-03-281-2/+5
| | | | | | | | | | We separated this out in the circmgr API. This is what the HS client needs. It doesn't want to participate in the general circuit pool.
* | arti-client: add accessors for `Blockage`eta2023-03-281-1/+13
|/ | | | Fixes #800.
* tor_client: Add some example code for BridgeConfig.Nick Mathewson2023-03-241-0/+49
| | | | Closes #791
* arti-client: Make TransportConfigListBuilder public.Nick Mathewson2023-03-241-1/+8
| | | | | | | Without this there's no convenient way to add a transport without messing with serde/toml. Found while working on #791
* Apply deferred rustfmt churnIan Jackson2023-03-231-1/+4
|
* arti-client: Include redacted HsId in ObtainHsCircuit errorIan Jackson2023-03-232-4/+4
| | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1071/diffs?commit_id=580fe1118dbbbfa086d11b28e3e26d7c91afe21c#fbd7ab2d6d0a5b515697d4f9f99a42ebd508aa4b_153_165
* arti-client: Fix wording of docs for TorClient::isolationIan Jackson2023-03-231-1/+1
|
* arti-client: Strengthen an HS todoNick Mathewson2023-03-231-1/+1
|
* arti-client: Call tor-hsclient to create HS connectionsIan Jackson2023-03-232-4/+27
| | | | | Obviously this still doesn't work because the actual impl in hsclient is just a todo!().
* arti-client: Create an HsClientConnectorIan Jackson2023-03-232-0/+22
|
* arti-client: Move client stream creation out of match, in connectIan Jackson2023-03-231-16/+17
| | | | We want this part for HS too.
* arti-client: Break out TorClient::isolation(prefs)Ian Jackson2023-03-231-17/+32
| | | | | | | | We're going to want to reuse this. Also: rename StreamPrefs::isolation and update the docs, to better reflect its rather limited functionality. The new TorClient::isolation is the only call site.
* Discuss in comment why we're not using a newtype for the Strings in HostIan Jackson2023-03-091-0/+8
|
* Classify OnionAddressResolveRequest as NotImplementedIan Jackson2023-03-091-2/+1
| | | | | | | | We have a theory about how this ought to work, so it's noit an API usage error - it's an unimplemented feature. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1060#note_2884757
* Reject invalid hostnamesIan Jackson2023-03-091-2/+5
| | | | | | Reject them both for .onion and for "exit" hostnames This prevents a `Host` from having an invalid hostname in it.
* Fix reference to no-longer-contemplated Host variantIan Jackson2023-03-091-1/+1
| | | | | Reported in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1060#note_2884755
* Dummy HsId::from_str on .onion: Return Bug, rather than panickingIan Jackson2023-03-091-5/+4
| | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1060#note_2884754
* Improve error from HsId parse of "www.B32.onion"Ian Jackson2023-03-092-0/+3
| | | | And add some clarity and todos about address errors.
* Avoid arti_client::ErrorDetail::Address for TorAddrError::InvalidHostnameIan Jackson2023-03-091-1/+19
| | | | Provide an explicit From impl isntead.
* arti-client: Parse .onion addresses and dispatch to client.rsIan Jackson2023-03-093-26/+162
| | | | | | | Now, a Host has a separate variant for `.onion` which is always used, even when HS is disabled. Currently it ends in a todo!.
* arti-client: DoThingInstructions: Make error returns consistentIan Jackson2023-03-092-9/+10
| | | | This is more comprehensible, and will be more convenient.
* arti-client: Host: Use Display::fmt rather than write!Ian Jackson2023-03-091-2/+3
| | | | | write! is less good because the `{}` overwrites stuff like "did the caller ask for padding".
* Merge branch 'suffix' into 'main'Nick Mathewson2023-03-081-1/+1
|\ | | | | | | | | Introduce and use ends_with_ignore_ascii_case See merge request tpo/core/arti!1058
| * Introduce and use ends_with_ignore_ascii_caseIan Jackson2023-03-081-1/+1
| | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/1056#note_2884428
* | Merge branch 'host2' into 'main'Ian Jackson2023-03-082-47/+140
|\ \ | |/ |/| | | | | arti-client: Do not send resolve requests for IP addrs to exits See merge request tpo/core/arti!1057