Cannot Connect To Onion Service

I’m experimenting with arti_client library, however, I am unable to connect to an onion service.

I did enable the feature like so: arti-client = { version = “0.23.0”, features = [“onion-service-client”]}

However, “tor_client.connect((address, 80))” returns “Error { detail: OnionAddressDisabled }”

I have looked trough the documentation but I wasn’t able to figure it out. Forgive me if I am missing something obvious as I am learning Rust as I am learning Arti.

I managed to solve it. The root cause was me not digging deep enough into the documentation prior to making this post, however in my defense, it would have been really helpful to have an example somewhere in the documentation.

Now that I am a bit more familiar with the Arti it all makes sense and seems obvious, however, it wasn’t at first. Therefore if someone would be nice enough to point me how can I contribute the code example I would be grateful.

In the meantime here is how I did it:

  • First I made my steam stream preferences using “StreamPrefs::new()”
  • Then I called “connect_to_onion_services(arti_client::config::BoolOrAuto::Explicit(true))” on my stream preferences
  • After building my Tor client I could call “tor_client.connect_with_prefs((address.clone(), port), &s_prefs)” on it to connect using my preferences.
  • And finally in your Cargo.toml you must have this feature enabled “arti-client = { version = “0.23.0”, features = [“onion-service-client”]}”
1 Like

Thanks for the update!

I’ve opened a ticket at Improve usability/documentation for using API to connect to onion services (#1651) · Issues · The Tor Project / Core / Arti · GitLab to try to make this kind of code easier to write, and to try to make this kind of bug easier to diagnose.

For a decent wrapper around arti-client, see:

I’ll have a newer version up targeting 0.24.0 shortly after its release supporting restricted discovery and the newer friendlier apis.