Skip to content
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
ad5c745
tor: integrated client for listener, update tokio to last version
ardocrat May 22, 2026
0f88f7a
tor: send transaction with integrated client
ardocrat May 23, 2026
0195c16
build: code format
ardocrat May 23, 2026
8d5ac7b
tor: optimize bootstrap percent check
ardocrat Jun 7, 2026
379b094
tor: handle config build error
ardocrat Jun 7, 2026
efd73ce
tor: do not show slatepack address if tor not launched
ardocrat Jun 7, 2026
bef3c4c
tor: handle keystore errors
ardocrat Jun 7, 2026
aec5fa1
tor: keep service launched
ardocrat Jun 8, 2026
4316385
tor: bootstrap timeout, clean cache before client launch
ardocrat Jun 9, 2026
4ea8cd2
Merge branch 'staging' into arti
ardocrat Jun 9, 2026
51fe193
tor: post request timeout
ardocrat Jun 9, 2026
f35345f
fix: post timeout
ardocrat Jun 9, 2026
8d188df
Merge branch 'staging' into arti
ardocrat Jun 9, 2026
297e533
build: update deps after merge
ardocrat Jun 9, 2026
903fb38
tor: store arti runtime
ardocrat Jun 9, 2026
aeddb02
tor: do not send over tor if `manual` arg presents or `skip_send_atte…
ardocrat Jun 9, 2026
d9c72dd
fix: arg name
ardocrat Jun 9, 2026
7bb641b
tor: handle arti runtime creation error
ardocrat Jun 9, 2026
4871009
tor: handle connection error
ardocrat Jun 9, 2026
8982c91
tor: handle bootstrap error
ardocrat Jun 9, 2026
ca6c9ec
tor: handle start service name error
ardocrat Jun 9, 2026
e266085
tor: handle service config creation error
ardocrat Jun 9, 2026
77f3e22
tor: service proxy errors
ardocrat Jun 9, 2026
c2522b2
tor: handle service key creation emptiness
ardocrat Jun 9, 2026
f552f54
build: format code
ardocrat Jun 9, 2026
09fea00
build: update arti to 0.43, hyper to 0.10.1
ardocrat Jun 13, 2026
ee4dee2
api: start foreign listener before tor connection
ardocrat Jun 20, 2026
b614831
tor: handle json parse errors
ardocrat Jun 20, 2026
23341d3
tor: prevent to create several client runtimes, ability to recreate
ardocrat Jun 20, 2026
68f46de
tor: return bootstrap error
ardocrat Jun 21, 2026
192e14d
tor: handle host parse error
ardocrat Jun 21, 2026
ea8d3c6
tor: restart proxy on error
ardocrat Jun 21, 2026
a5dc72d
Merge remote-tracking branch 'grin-wallet/staging' into arti
ardocrat Jun 21, 2026
6182cf7
tor: do not use integrated client when config value use_integrated is…
ardocrat Jun 21, 2026
79d33b9
build: update lock file
ardocrat Jun 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions api/src/owner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ use uuid::Uuid;
use crate::config::{TorConfig, WalletConfig};
use crate::core::core::OutputFeatures;
use crate::core::global;
use crate::impls::HttpSlateSender;
use crate::impls::SlateSender as _;
use crate::impls::TorSlateSender;
use crate::keychain::{Identifier, Keychain};
use crate::libwallet::api_impl::owner_updater::{start_updater_log_thread, StatusMessage};
use crate::libwallet::api_impl::{owner, owner_updater};
Expand Down Expand Up @@ -669,17 +669,15 @@ where
};
// Helper functionality. If send arguments exist, attempt to send sync and
// finalize
let skip_tor = match send_args.as_ref() {
None => false,
Some(sa) => sa.skip_tor,
};
match send_args {
Some(sa) => {
let tor_config_lock = self.tor_config.lock();
let tc = tor_config_lock.clone();
let tc = match tc {
Some(mut c) => {
c.skip_send_attempt = Some(skip_tor);
if let Some(skip_tor) = sa.skip_tor {
c.skip_send_attempt = Some(skip_tor);
}
Some(c)
}
None => None,
Expand Down Expand Up @@ -845,7 +843,9 @@ where
let tc = tor_config_lock.clone();
let tc = match tc {
Some(mut c) => {
c.skip_send_attempt = Some(sa.skip_tor);
if let Some(skip_tor) = sa.skip_tor {
c.skip_send_attempt = Some(skip_tor);
}
Some(c)
}
None => None,
Expand Down Expand Up @@ -2495,7 +2495,7 @@ pub fn try_slatepack_sync_workflow(
slate: &Slate,
dest: &str,
tor_config: Option<TorConfig>,
tor_sender: Option<HttpSlateSender>,
tor_sender: Option<TorSlateSender>,
send_to_finalize: bool,
test_mode: bool,
) -> Result<Option<Slate>, Error> {
Expand All @@ -2505,7 +2505,7 @@ pub fn try_slatepack_sync_workflow(
}
}
let mut ret_slate = Slate::blank(2, false);
let mut send_sync = |mut sender: HttpSlateSender, method_str: &str| match sender
let mut send_sync = |mut sender: TorSlateSender, method_str: &str| match sender
.send_tx(&slate, send_to_finalize)
{
Ok(s) => {
Expand All @@ -2531,18 +2531,16 @@ pub fn try_slatepack_sync_workflow(
if test_mode {
None
} else {
match HttpSlateSender::with_socks_proxy(
&tor_addr.to_http_str(),
&tor_config.as_ref().unwrap().socks_proxy_addr,
&tor_config.as_ref().unwrap().send_config_dir,
tor_config.as_ref().unwrap().bridge.clone(),
tor_config.as_ref().unwrap().proxy.clone(),
) {
Ok(s) => Some(s),
Err(e) => {
debug!("Send (TOR): Cannot create TOR Slate sender {:?}", e);
None
if let Some(tc) = tor_config {
match TorSlateSender::new(&tor_addr.to_http_str(), tc) {
Ok(s) => Some(s),
Err(e) => {
debug!("Send (TOR): Cannot create TOR Slate sender {:?}", e);
None
}
}
} else {
return Err(Error::TorConfig("Tor config is not set".to_string()));
}
}
}
Expand Down
19 changes: 15 additions & 4 deletions config/src/comments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
Expand Down Expand Up @@ -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 = \"\"

Expand Down
6 changes: 6 additions & 0 deletions config/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(),
Expand All @@ -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
Expand All @@ -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,
}
Expand Down
2 changes: 1 addition & 1 deletion controller/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ log = "0.4"
prettytable-rs = "0.10"
ring = "0.16"
term = "0.6"
tokio = { version = "0.2", features = ["full"] }
tokio = { version = "1.52.3", features = ["full"] }
uuid = { version = "0.8", features = ["serde", "v4"] }
url = "2.1"
chrono = { version = "0.4.11", features = ["serde"] }
Expand Down
22 changes: 14 additions & 8 deletions controller/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ where
g_args.tls_conf.clone(),
tor_config.use_tor_listener,
test_mode,
Some(tor_config.clone()),
tor_config,
);
if let Err(e) = res {
error!("Error starting listener: {}", e);
Expand Down Expand Up @@ -335,7 +335,7 @@ pub struct SendArgs {
pub target_slate_version: Option<u16>,
pub payment_proof_address: Option<SlatepackAddress>,
pub ttl_blocks: Option<u64>,
pub skip_tor: bool,
pub skip_tor: Option<bool>,
pub outfile: Option<String>,
pub bridge: Option<String>,
pub slatepack_qr: bool,
Expand Down Expand Up @@ -431,7 +431,9 @@ where
if let Some(b) = args.bridge.clone() {
c.bridge.bridge_line = Some(b);
}
c.skip_send_attempt = Some(args.skip_tor);
if let Some(s) = args.skip_tor {
c.skip_send_attempt = Some(s);
}
Some(c)
}
None => None,
Expand Down Expand Up @@ -630,7 +632,7 @@ where
pub struct ReceiveArgs {
pub input_file: Option<String>,
pub input_slatepack_message: Option<String>,
pub skip_tor: bool,
pub skip_tor: Option<bool>,
pub outfile: Option<String>,
pub bridge: Option<String>,
pub slatepack_qr: bool,
Expand Down Expand Up @@ -666,7 +668,9 @@ where
if let Some(b) = args.bridge {
c.bridge.bridge_line = Some(b);
}
c.skip_send_attempt = Some(args.skip_tor);
if let Some(s) = args.skip_tor {
c.skip_send_attempt = Some(s);
}
Some(c)
}
None => None,
Expand All @@ -688,7 +692,7 @@ where
Ok(Some(_)) => {
println!();
println!(
"Transaction recieved and sent back to sender at {} for finalization.",
"Transaction received and sent back to sender at {} for finalization.",
dest
);
println!();
Expand Down Expand Up @@ -925,7 +929,7 @@ pub struct ProcessInvoiceArgs {
pub slate: Slate,
pub estimate_selection_strategies: bool,
pub ttl_blocks: Option<u64>,
pub skip_tor: bool,
pub skip_tor: Option<bool>,
pub outfile: Option<String>,
pub bridge: Option<String>,
pub slatepack_qr: bool,
Expand Down Expand Up @@ -1008,7 +1012,9 @@ where
if let Some(b) = args.bridge {
c.bridge.bridge_line = Some(b);
}
c.skip_send_attempt = Some(args.skip_tor);
if let Some(skip_tor) = args.skip_tor {
c.skip_send_attempt = Some(skip_tor);
}
Some(c)
}
None => None,
Expand Down
Loading