mirror of
https://github.com/creating2morrow/neveko.git
synced 2024-12-23 03:59:24 +00:00
create socks proxy with --i2p-socks-proxy-host cli arg
This commit is contained in:
parent
9077a61cfd
commit
b8505d3c4e
4 changed files with 40 additions and 35 deletions
|
@ -170,6 +170,10 @@ pub struct Args {
|
||||||
)]
|
)]
|
||||||
pub i2p_normal: bool,
|
pub i2p_normal: bool,
|
||||||
/// i2p anonymous inbound port
|
/// i2p anonymous inbound port
|
||||||
#[arg(long, help = "Set i2p anon inbound connectivity", default_value = "38089")]
|
#[arg(
|
||||||
|
long,
|
||||||
|
help = "Set i2p anon inbound connectivity",
|
||||||
|
default_value = "38089"
|
||||||
|
)]
|
||||||
pub anon_inbound_port: u16,
|
pub anon_inbound_port: u16,
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,11 +74,11 @@ async fn find_tunnels() {
|
||||||
debug!("i2p tunnels: {}", contents);
|
debug!("i2p tunnels: {}", contents);
|
||||||
let has_app_tunnel = contents.contains(&format!("{}", app_port));
|
let has_app_tunnel = contents.contains(&format!("{}", app_port));
|
||||||
let proxy_port = get_i2p_proxy_port();
|
let proxy_port = get_i2p_proxy_port();
|
||||||
let tx_proxy_port = monero::get_daemon_port();
|
let socks_proxy_port = get_i2p_socks_proxy_port();
|
||||||
let has_http_tunnel = contents.contains(&proxy_port);
|
let has_http_tunnel = contents.contains(&proxy_port);
|
||||||
let has_tx_proxy_tunnel = contents.contains(&format!("{}", &tx_proxy_port));
|
let has_socks_proxy_tunnel = contents.contains(&format!("{}", &socks_proxy_port));
|
||||||
let has_anon_inbound_tunnel = contents.contains(&format!("{}", args.anon_inbound_port));
|
let has_anon_inbound_tunnel = contents.contains(&format!("{}", args.anon_inbound_port));
|
||||||
if !has_app_tunnel || !has_http_tunnel || !has_anon_inbound_tunnel {
|
if !has_app_tunnel || !has_http_tunnel || !has_anon_inbound_tunnel || !has_socks_proxy_tunnel {
|
||||||
tokio::time::sleep(Duration::new(120, 0)).await;
|
tokio::time::sleep(Duration::new(120, 0)).await;
|
||||||
}
|
}
|
||||||
if !has_app_tunnel {
|
if !has_app_tunnel {
|
||||||
|
@ -93,15 +93,11 @@ async fn find_tunnels() {
|
||||||
debug!("creating anon inbound tunnel");
|
debug!("creating anon inbound tunnel");
|
||||||
create_anon_inbound_tunnel();
|
create_anon_inbound_tunnel();
|
||||||
}
|
}
|
||||||
let env = utils::get_release_env();
|
if !has_socks_proxy_tunnel {
|
||||||
// only use tx proxy on mainnet
|
debug!("creating socks proxy tunnel");
|
||||||
if env == utils::ReleaseEnvironment::Production {
|
|
||||||
if !has_tx_proxy_tunnel && !utils::is_using_remote_node() {
|
|
||||||
debug!("creating tx proxy tunnel");
|
|
||||||
create_tx_proxy_tunnel();
|
create_tx_proxy_tunnel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/// Called on application startup for i2p tunnel creation,
|
/// Called on application startup for i2p tunnel creation,
|
||||||
///
|
///
|
||||||
|
@ -146,9 +142,9 @@ fn create_tunnel() {
|
||||||
debug!("{:?}", output.stdout);
|
debug!("{:?}", output.stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an i2p tunnel for the monero tx proxy
|
/// Create an i2p tunnel for the monero wallet socks proxy
|
||||||
fn create_tx_proxy_tunnel() {
|
fn create_tx_proxy_tunnel() {
|
||||||
info!("creating monerod tx proxy tunnel");
|
info!("creating monerod socks proxy tunnel");
|
||||||
let args = args::Args::parse();
|
let args = args::Args::parse();
|
||||||
let path = args.i2p_zero_dir;
|
let path = args.i2p_zero_dir;
|
||||||
let output = Command::new(format!("{}/router/bin/tunnel-control.sh", path))
|
let output = Command::new(format!("{}/router/bin/tunnel-control.sh", path))
|
||||||
|
@ -158,7 +154,7 @@ fn create_tx_proxy_tunnel() {
|
||||||
&format!("{}", get_i2p_socks_proxy_port()),
|
&format!("{}", get_i2p_socks_proxy_port()),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("i2p-zero failed to create a tx proxy tunnel");
|
.expect("i2p-zero failed to create a socks proxy tunnel");
|
||||||
debug!("{:?}", output.stdout);
|
debug!("{:?}", output.stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,9 +193,15 @@ pub fn start_rpc() {
|
||||||
let rpc_login = format!("{}:{}", &login.username, &login.credential);
|
let rpc_login = format!("{}:{}", &login.username, &login.credential);
|
||||||
let release_env = utils::get_release_env();
|
let release_env = utils::get_release_env();
|
||||||
let is_dev = release_env == utils::ReleaseEnvironment::Development;
|
let is_dev = release_env == utils::ReleaseEnvironment::Development;
|
||||||
let wallet_path = if is_dev { ".neveko/stagenet/wallet/" } else { ".neveko/wallet/" };
|
let wallet_path = if is_dev {
|
||||||
|
".neveko/stagenet/wallet/"
|
||||||
|
} else {
|
||||||
|
".neveko/wallet/"
|
||||||
|
};
|
||||||
let wallet_dir = format!(
|
let wallet_dir = format!(
|
||||||
"/home/{}/{}", std::env::var("USER").unwrap_or(String::from("user")), wallet_path
|
"/home/{}/{}",
|
||||||
|
std::env::var("USER").unwrap_or(String::from("user")),
|
||||||
|
wallet_path
|
||||||
);
|
);
|
||||||
if cli_args.remote_node && !&daemon_address.contains(".i2p") {
|
if cli_args.remote_node && !&daemon_address.contains(".i2p") {
|
||||||
warn!("invalid i2p monero remote node detected");
|
warn!("invalid i2p monero remote node detected");
|
||||||
|
|
|
@ -242,7 +242,6 @@ pub fn get_i2p_wallet_proxy_host() -> String {
|
||||||
args.i2p_socks_proxy_host
|
args.i2p_socks_proxy_host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// app auth port
|
/// app auth port
|
||||||
pub fn get_app_auth_port() -> u16 {
|
pub fn get_app_auth_port() -> u16 {
|
||||||
let args = args::Args::parse();
|
let args = args::Args::parse();
|
||||||
|
|
Loading…
Reference in a new issue