From 582154c72ce4f92ad100e724ef9fc1049a046859 Mon Sep 17 00:00:00 2001 From: creating2morrow Date: Wed, 28 Jun 2023 18:08:46 -0400 Subject: [PATCH] don't use port on remote nodes --- neveko-core/src/args.rs | 3 +++ neveko-core/src/monero.rs | 11 ++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/neveko-core/src/args.rs b/neveko-core/src/args.rs index 162dcfc..7003c3a 100644 --- a/neveko-core/src/args.rs +++ b/neveko-core/src/args.rs @@ -162,4 +162,7 @@ pub struct Args { default_value = "false" )] pub i2p_normal: bool, + /// anonymous inbound port, must be localhost + #[arg(long, help = "Set app marketplace admin port", default_value = "38089")] + pub anon_inbound_port: u16, } diff --git a/neveko-core/src/monero.rs b/neveko-core/src/monero.rs index 0443035..d18ceca 100644 --- a/neveko-core/src/monero.rs +++ b/neveko-core/src/monero.rs @@ -160,9 +160,9 @@ pub fn start_daemon() { let bin_dir = get_monero_location(); let release_env = utils::get_release_env(); let tx_proxy = format!("i2p,{}", utils::get_i2p_http_proxy()); - let port = get_daemon_port(); + let port = get_anon_inbound_port(); let destination = i2p::get_destination(Some(port)); - let anon_inbound = format!("{},127.0.0.1:{},8", destination, port); + let anon_inbound = format!("{},127.0.0.1:{}", destination, port); if release_env == utils::ReleaseEnvironment::Development { let args = ["--data-dir", &blockchain_dir, "--stagenet", "--detach"]; let output = Command::new(format!("{}/monerod", bin_dir)) @@ -275,7 +275,7 @@ pub fn get_daemon_port() -> u16 { let rpc = String::from(args.monero_rpc_daemon); let values = rpc.split(":"); let mut v: Vec = values.map(|s| String::from(s)).collect(); - let port = v.remove(2); + let port = if !args.remote_node { v.remove(2) } else { String::from("0") }; debug!("monerod port: {}", port); match port.parse::() { Ok(p) => p, @@ -283,6 +283,11 @@ pub fn get_daemon_port() -> u16 { } } +pub fn get_anon_inbound_port() -> u16 { + let args = args::Args::parse(); + args.anon_inbound_port +} + /// Get monero rpc host from command line argument fn get_blockchain_dir() -> String { let args = args::Args::parse();