summaryrefslogtreecommitdiff
path: root/crates/arti/src
Commit message (Collapse)AuthorAgeFilesLines
...
| * logging: Drop a pointless .within() callIan Jackson2022-04-251-2/+1
| | | | | | | | | | | | | | | | | | | | Since "logfiles: Introduce LogfileListConfigBuilder", this code is in LogfileListConfigBuilder::build(), which is called by derive_builder's generated LoggingConfig::build(), and which will add a file context itself due to the `sub_builder` feature. So this is otiose. And, we are about to replace this whole thing with macro_rules-generated code (which won't do this).
* | squash! Bump every crate's edition to 2021.Nick Mathewson2022-04-254-7/+0
|/ | | | | Remove all `use` statements for `TryFrom` and `TryInto`. These are now redundant in Rust 2021.
* arti: ArtiConfig: derive ArtiConfigBuilderIan Jackson2022-04-221-87/+13
| | | | Replace handwritten builder struct, accessors, and builder function.
* logfiles: Introduce LogfileListConfigBuilderIan Jackson2022-04-221-16/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | In https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/462#note_2797697 we decided not to do this. However, having looked again at the way the FallbackList works, I think there is a lot of value in making these two things (and anything else like them[1]) as similar as possible. [1] At least PreemptiveCircuitConfig.initial_predicted_ports and NetworkConfig.authorities need the same treatment, and perhaps also GuardUsage.restrictions (although there is no GuardRestrictionBuilder). In the irc discussion I imagined `LogfilesConfigBuilder` as opposed to `LogfileConfigBuilder` (differing only in the `s`) which would be bad, but we can use `List` instead. We do *not* need to abstract away the validated version of the config. Providing a type alias helps the derive_builder sub_builder DTRT without needing special overrides. I have split this commit so that we can drop it, if we conclude it's not wanted.
* logfiles: Adjust LoggingConfigBuilder::file and impl DeserializeIan Jackson2022-04-221-1/+54
| | | | | | | | | Change LoggingConfigBuilder to contain Vec<LogfileConfigBuilder>, not Option<Vec<LogfileConfig>>. That makes it sane to Deserialize. Replace LoggingConfigBuilder's file(Vec<>) setter with the methods discussed in https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/462#note_2797697
* logfiles Rename LogfileConfig::file to filesIan Jackson2022-04-221-4/+4
| | | | | It's a plural, and that fact is going to be exposed via serde, if it isn't already.
* fallback list: Introduce and use FallbackListBuilderIan Jackson2022-04-221-3/+3
| | | | | | | | | Now the network fallbacks configuration wants to Deserialize a Vec<FallbackDirBuilder>, rather than validated Vec<FallbackDir>. Methods on FallbackListBuilder are as per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/462#note_2797697 mutatis mutandi for the fact that this struct has only fallbacks in it.
* rename *_isolation_group to *_isolationtrinity-1686a2022-03-242-2/+2
|
* Move SystemConfig to arti::cfgIan Jackson2022-03-213-6/+39
| | | | Fixes #314, #418.
* Run rustfmt to tidy up importsIan Jackson2022-03-211-1/+4
|
* ApplicationConfig: abolish accessorIan Jackson2022-03-213-10/+3
|
* Move ApplicationConfig to arti crateIan Jackson2022-03-212-2/+26
| | | | Code motion and import fixups.
* socks: abolish config accessorsIan Jackson2022-03-212-19/+4
| | | | | Making these fields pub(crate) is quite reasonable and does away with the need for accessors.
* Move ProxyConfig to arti crateIan Jackson2022-03-212-2/+51
| | | | | | | We put this in cfg.rs, rather than (say) socks.rs, because it has config relating to both socks.rs and dns.rs. Code motion and import fixups.
* Tidy up filt_from_opt_strIan Jackson2022-03-211-4/+3
| | | | This was clumsy. Now it is brought together it can be simplified.
* Abolish logging filter option accessorsIan Jackson2022-03-211-19/+7
| | | | | | | This de-duplicates the code that was in those accessors, and is now in filt_from_opt_str. Code motion and direct field access.
* Abolish easy accessors for logging configIan Jackson2022-03-211-26/+6
| | | | | | There are no longer needed, because the code that uses this configuration now lives in the same module as the configuration itself.
* Move logging configuration from arti_config::options to arti::loggingIan Jackson2022-03-213-5/+131
| | | | Code motion and import fixups.
* Rename arti::trace module to arti::loggingIan Jackson2022-03-212-2/+2
| | | | | We are going to move LoggingConfig here. We should follow the already-public name IMO.
* Move ArtiConfig to new arti::cfg moduleIan Jackson2022-03-213-3/+276
| | | | Code motion and import fixups.
* Alternative API for set_isolation_group().Nick Mathewson2022-03-172-2/+2
| | | | | | | | | | | | 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-173-110/+48
|\ | | | | | | | | new api for isolation See merge request tpo/core/arti!377
| * add isolation to dns requeststrinity-1686a2022-03-162-9/+35
| |
| * accept boxed isolation in StreamPref::set_isolation_grouptrinity-1686a2022-03-161-1/+1
| |
| * add tests on Isolation and fix conditional compilation issuestrinity-1686a2022-03-161-2/+2
| | | | | | | | | | | | it seems I added conditional compilation without noticing it?? and there was some errors when choosing a prefered runtime depending on feature flags
| * replace IsolationMap with new Isolation traittrinity-1686a2022-03-161-102/+14
| |
* | Fix typoDimitris Apostolou2022-03-161-1/+1
|/
* make run_dns_resolver public and fix typotrinity-1686a2022-03-151-3/+2
|
* fix typos and minor issuestrinity-1686a2022-03-142-15/+23
|
* actually add DNS supporttrinity-1686a2022-03-142-4/+87
|
* add skeleton for DNS handlingtrinity-1686a2022-03-142-8/+90
|
* add udp to runtimetrinity-1686a2022-03-143-10/+69
|
* arti library crate: Add another note about panickingIan Jackson2022-03-111-0/+4
|
* arti library crate: re-add clippy lintsIan Jackson2022-03-111-0/+33
| | | | | | | I ought to have c&p these. As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/403#note_2786099
* arti library crate: Add note about panickingIan Jackson2022-03-111-0/+4
|
* arti: Make main module entrypoints pubIan Jackson2022-03-116-14/+14
| | | | | This does not constitute any kind of stable API promise. But it might allow people to use our arti client code in novel ways.
* arti: Provide some rubric docs.Ian Jackson2022-03-111-0/+8
|
* arti: Move all code from binary crate to library crateIan Jackson2022-03-112-261/+269
| | | | This is just code motion and the minimal fixups.
* Add config paths table in `arti` docsLennart Kloock2022-03-041-3/+8
|
* Merge branch 'clippy-allow-arc-clone' into 'main'Nick Mathewson2022-03-011-1/+0
|\ | | | | | | | | Disable clippy::clone_on_ref_ptr See merge request tpo/core/arti!352
| * Disable clippy::clone_on_ref_ptrIan Jackson2022-02-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This lint is IMO inherently ill-conceived. I have looked for the reasons why this might be thought to be a good idea and there were basically two (and they are sort of contradictory): I. "Calling ‘.clone()` on an Rc, Arc, or Weak can obscure the fact that only the pointer is being cloned, not the underlying data." This is the wording from https://rust-lang.github.io/rust-clippy/v0.0.212/#clone_on_ref_ptr It is a bit terse; we are left to infer why it is a bad idea to obscure this fact. It seems to me that if it is bad to obscure some fact, that must be because the fact is a hazard. But why would it be a hazard to not copy the underlying data ? In other languages, faliing to copy the underlying data is a serious correctness hazard. There is a whose class of bugs where things were not copied, and then mutated and/or reused in multiple places in ways that were not what the programmer intended. In my experience, this is a very common bug when writing Python and Javascript. I'm told it's common in golang too. But in Rust this bug is much much harder to write. The data inside an Arc is immutable. To have this bug you'd have use interior mutability - ie mess around with Mutex or RefCell. That provides a good barrier to these kind of accidents. II. "The reason for writing Rc::clone and Arc::clone [is] to make it clear that only the pointer is being cloned, as opposed to the underlying data. The former is always fast, while the latter can be very expensive depending on what is being cloned." This is the reasoning found here https://github.com/rust-lang/rust-clippy/issues/2048 This is saying that *not* using Arc::clone is hazardous. Specifically, that a deep clone is a performance hazard. But for this argument, the lint is precisely backwards. It's linting the "good" case and asking for it to be written in a more explicit way; while the supposedly bad case can be written conveniently. Also, many objects (in our codebase, and in all the libraries we use) that are Clone are in fact simply handles. They contain Arc(s) (or similar) and are cheap to clone. Indeed, that is the usual case. It does not make sense to distinguish in the syntax we use to clone such a handle, whether the handle is a transparent Arc, or an opaque struct containing one or more other handles. Forcing Arc::clone to be written as such makes for code churn when a type is changed from Arc<Something> to Something: Clone, or vice versa.
* | Merge branch 'main'Ian Jackson2022-03-011-1/+16
|\ \ | | | | | | | | | | | | | | | | | | Fixed conflict in crates/arti-client/src/lib.rs as per tree from https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/364/#note_2782166 ie 13e55b8d7c22c26e55ba75823409b477f1bce66b
| * | Split "static" into sqlite and native-tls features.Nick Mathewson2022-02-251-1/+16
| | | | | | | | | | | | | | | | | | | | | Otherwise, it's impossible to get a static sqlite linkage without also getting native-tls, even if you wanted rustls. Closes #302.
* | | arti-client: use PreferredRuntime by default, doc cleanupseta2022-02-281-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Upgrade to newer version of config crate.Nick Mathewson2022-02-252-0/+3
| |
* | Upgrade dependency to new version of rlimit.Nick Mathewson2022-02-251-1/+1
| |
* | Merge branch 'socks-version-is-http' into 'main'eta2022-02-241-1/+36
|\ \ | |/ |/| | | | | make arti return a web page when receiving http request on socks port See merge request tpo/core/arti!348
| * use less magic in http checktrinity-1686a2022-02-241-2/+4
| |
| * make arti return a web page when receiving http request on socks porttrinity-1686a2022-02-231-1/+34
| |
* | Merge branch 'client_builder' into 'main'Nick Mathewson2022-02-231-1/+4
|\ \ | |/ |/| | | | | | | | | Make a TorClientBuilder API. Closes #350 See merge request tpo/core/arti!337