Skip to content

Commit

Permalink
feat: don't use tor on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
stringhandler committed Aug 1, 2024
1 parent bc8a9d1 commit 92983a4
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
19 changes: 16 additions & 3 deletions src-tauri/src/minotari_node_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ use tokio::task::JoinHandle;

pub struct MinotariNodeAdapter {
force_download: bool,
use_tor: bool
}

impl MinotariNodeAdapter {
pub fn new() -> Self {
pub fn new(use_tor: bool) -> Self {
Self {
force_download: false,
use_tor
}
}
}
Expand All @@ -31,12 +33,23 @@ impl ProcessAdapter for MinotariNodeAdapter {
dbg!("STarting node");
let working_dir = data_local_dir().unwrap().join("tari-universe").join("node");
std::fs::create_dir_all(&working_dir)?;
let args: Vec<String> = vec![

let mut args: Vec<String> = vec![
"-b".to_string(),
working_dir.to_str().unwrap().to_string(),
"--non-interactive-mode".to_string(),
"--mining-enabled".to_string()
"--mining-enabled".to_string(),
// "-p\"base_node.grpc_server_allow_methods\"=get_network_difficulty".to_string(),
];
if !self.use_tor {
// TODO: This is a bit of a hack. You have to specify a public address for the node to bind to.
// In future we should change the base node to not error if it is tcp and doesn't have a public address
args.push("-p".to_string());
args.push("base_node.p2p.transport.type=tcp".to_string());
args.push("-p".to_string());
args.push("base_node.p2p.public_addresses=/ip4/172.2.3.4/tcp/18189".to_string());
// args.push("-p\"base_node.p2p.transport.tcp.listener_address\"=\"/ip4/0.0.0.0/tcp/18189\"".to_string());
}
dbg!(&args);
Ok((
MinotariNodeInstance {
Expand Down
13 changes: 12 additions & 1 deletion src-tauri/src/node_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@ pub struct NodeManager {

impl NodeManager {
pub fn new() -> Self {
let sidecar_adapter = MinotariNodeAdapter::new();
// TODO: wire up to front end
let mut use_tor = true;


// Unix systems have built in tor.
// TODO: Add tor service for windows.
#[cfg(target_os = "windows")]
{
use_tor = false;
}

let sidecar_adapter = MinotariNodeAdapter::new(use_tor);
let process_watcher = ProcessWatcher::new(sidecar_adapter);

Self {
Expand Down

0 comments on commit 92983a4

Please sign in to comment.