Skip to content

arti_client: Restructure client construction API

IMO:

One should construct a new client like this:

use arti_client::tokio_native_tls as tor; 
tor::TorClient::new_config().some_setting(42)?.bootstrap()?`

I.e.:

  • bootstrap should be a method on TorClientCfg, not an inherent impl on TorClient. (I think providing the same function with two names is confusing unless it's done for convenience for a the function which is is used very frequently.)

  • The distinction between TorClientConfigBuilder and TorClientCfg should be abolished. The distinction between validated and unvalidated configs should not be exposed; instead, bootstrap should operate on the unvalidated config and validate it before proceeding.

  • There should be modules with ready-specialised (for runtime, etc.) versions of TorClient etc. which avoids having to wrestle runtime and other generics.

See also #278 (closed), which requests a version of bootstrap that does lazy init instead. That would be another method on TorClientCfg.

Edited by Nick Mathewson