Integrated Tor arti Client (#750)

* tor: integrated client for listener, update tokio to last version

* tor: send transaction with integrated client

* build: code format

* tor: optimize bootstrap percent check

* tor: handle config build error

* tor: do not show slatepack address if tor not launched

* tor: handle keystore errors

* tor: keep service launched

* tor: bootstrap timeout, clean cache before client launch

* tor: post request timeout

* fix: post timeout

* build: update deps after merge

* tor: store arti runtime

* tor: do not send over tor if `manual` arg presents or `skip_send_attempt` set at config

* fix: arg name

* tor: handle arti runtime creation error

* tor: handle connection error

* tor: handle bootstrap error

* tor: handle start service name error

* tor: handle service config creation error

* tor: service proxy errors

* tor: handle service key creation emptiness

* build: format code

* build: update arti to 0.43, hyper to 0.10.1

* api: start foreign listener before tor connection

* tor: handle json parse errors

* tor: prevent to create several client runtimes, ability to recreate

* tor: return bootstrap error

* tor: handle host parse error

* tor: restart proxy on error

* tor: do not use integrated client when config value use_integrated is missing, add logging

* build: update lock file
This commit is contained in:
ardocrat
2026-06-21 14:20:34 +02:00
committed by GitHub
parent ca5686aa04
commit 411bcff003
17 changed files with 5070 additions and 828 deletions
+15 -4
View File
@@ -206,16 +206,24 @@ fn comments() -> HashMap<String, String> {
"[tor]".to_string(),
"
#########################################
### TOR CONFIGURATION (Experimental) ###
### TOR CONFIGURATION ###
#########################################
"
.to_string(),
);
retval.insert(
"use_integrated".to_string(),
"
#Whether to use integrated Tor library
"
.to_string(),
);
retval.insert(
"skip_send_attempt".to_string(),
"
#Whether to skip send attempts (used for debugging)
#Whether to skip send attempts (default false)
"
.to_string(),
);
@@ -259,8 +267,11 @@ fn comments() -> HashMap<String, String> {
"
#Tor bridge relay: allow to send and receive via TOR in a country where it is censored.
#Enable it by entering a single bridge line. To disable it, you must comment it.
#Support of the transport: obfs4, meek and snowflake.
#obfs4proxy or snowflake client binary must be installed and on your path.
#Support of the transport: webtunnel, obfs4, and snowflake.
#webtunnel, obfs4proxy or snowflake client binary must be installed and on your path.
#Custom path for client binary
#bridge_bin_path = \"\"
#For example, the bridge line must be in the following format for obfs4 transport: \"obfs4 [IP:PORT] [FINGERPRINT] cert=[CERT] iat-mode=[IAT-MODE]\"
#bridge_line = \"\"
+6
View File
@@ -162,6 +162,8 @@ impl From<io::Error> for ConfigError {
/// Tor configuration
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TorConfig {
/// whether to use integrated Tor library
pub use_integrated: Option<bool>,
/// whether to skip any attempts to send via TOR
pub skip_send_attempt: Option<bool>,
/// Whether to start tor listener on listener startup (default true)
@@ -181,6 +183,7 @@ pub struct TorConfig {
impl Default for TorConfig {
fn default() -> TorConfig {
TorConfig {
use_integrated: Some(true),
skip_send_attempt: Some(false),
use_tor_listener: true,
socks_proxy_addr: "127.0.0.1:59050".to_owned(),
@@ -194,6 +197,8 @@ impl Default for TorConfig {
/// Tor Bridge Config
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct TorBridgeConfig {
/// Path to bridge binary to use with integrated Tor library
pub bridge_bin_path: Option<String>,
/// Bridge Line
pub bridge_line: Option<String>,
/// Client Option
@@ -203,6 +208,7 @@ pub struct TorBridgeConfig {
impl Default for TorBridgeConfig {
fn default() -> TorBridgeConfig {
TorBridgeConfig {
bridge_bin_path: None,
bridge_line: None,
client_option: None,
}