mirror of
https://github.com/creating2morrow/neveko.git
synced 2024-12-22 19:49:24 +00:00
facilitate remote i2p proxy server
This commit is contained in:
parent
196cbefd8f
commit
76b8336a5a
5 changed files with 46 additions and 6 deletions
|
@ -137,8 +137,22 @@ pub struct Args {
|
||||||
/// Remove all failed-to-send messages from db on app startup
|
/// Remove all failed-to-send messages from db on app startup
|
||||||
#[arg(
|
#[arg(
|
||||||
long,
|
long,
|
||||||
help = "this will clear failed-to-send messages from the databse",
|
help = "this will clear failed-to-send messages from the database",
|
||||||
default_value = "false"
|
default_value = "false"
|
||||||
)]
|
)]
|
||||||
pub clear_fts: bool,
|
pub clear_fts: bool,
|
||||||
|
/// Manually configure i2p
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
help = "ADVANCED. Neveko will no longer handle i2p proxy tunnels or identity.",
|
||||||
|
default_value = "false"
|
||||||
|
)]
|
||||||
|
pub i2p_advanced: bool,
|
||||||
|
/// Dummy flag for normal neveko i2p-zero config. Future use.
|
||||||
|
#[arg(
|
||||||
|
long,
|
||||||
|
help = "Normal mode. Neveko will handle i2p proxy tunnels and identity.",
|
||||||
|
default_value = "false"
|
||||||
|
)]
|
||||||
|
pub i2p_normal: bool,
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ fn create_tunnel() {
|
||||||
&format!("{}", utils::get_app_port()),
|
&format!("{}", utils::get_app_port()),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("i2p-zero failed to create a tunnel");
|
.expect("i2p-zero failed to create a app tunnel");
|
||||||
debug!("{:?}", output.stdout);
|
debug!("{:?}", output.stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,7 +152,7 @@ fn create_tx_proxy_tunnel() {
|
||||||
&format!("{}", monero::get_daemon_port()),
|
&format!("{}", monero::get_daemon_port()),
|
||||||
])
|
])
|
||||||
.spawn()
|
.spawn()
|
||||||
.expect("i2p-zero failed to create a tunnel");
|
.expect("i2p-zero failed to create a tx proxy tunnel");
|
||||||
debug!("{:?}", output.stdout);
|
debug!("{:?}", output.stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ pub const NEVEKO_JWT_SECRET_KEY: &str = "NEVEKO_JWT_SECRET_KEY";
|
||||||
|
|
||||||
/// Environment variable for injecting wallet password
|
/// Environment variable for injecting wallet password
|
||||||
pub const MONERO_WALLET_PASSWORD: &str = "MONERO_WALLET_PASSWORD";
|
pub const MONERO_WALLET_PASSWORD: &str = "MONERO_WALLET_PASSWORD";
|
||||||
|
/// Environment variable for I2P proxy host
|
||||||
|
pub const NEVEKO_I2P_PROXY_HOST: &str = "NEVEKO_I2P_PROXY_HOST";
|
||||||
|
|
||||||
/// The latest monero release download
|
/// The latest monero release download
|
||||||
pub const MONERO_RELEASE_VERSION: &str = "monero-linux-x64-v0.18.2.2.tar.bz2";
|
pub const MONERO_RELEASE_VERSION: &str = "monero-linux-x64-v0.18.2.2.tar.bz2";
|
||||||
|
|
|
@ -84,8 +84,10 @@ impl Default for Installations {
|
||||||
pub struct Connections {
|
pub struct Connections {
|
||||||
pub blockchain_dir: String,
|
pub blockchain_dir: String,
|
||||||
pub daemon_host: String,
|
pub daemon_host: String,
|
||||||
|
pub i2p_proxy_host: String,
|
||||||
pub i2p_zero_dir: String,
|
pub i2p_zero_dir: String,
|
||||||
pub is_remote_node: bool,
|
pub is_remote_node: bool,
|
||||||
|
pub is_i2p_advanced: bool,
|
||||||
pub mainnet: bool,
|
pub mainnet: bool,
|
||||||
pub monero_location: String,
|
pub monero_location: String,
|
||||||
pub rpc_credential: String,
|
pub rpc_credential: String,
|
||||||
|
@ -98,8 +100,10 @@ impl Default for Connections {
|
||||||
Connections {
|
Connections {
|
||||||
blockchain_dir: String::from("/home/user/.bitmonero"),
|
blockchain_dir: String::from("/home/user/.bitmonero"),
|
||||||
daemon_host: String::from("http://localhost:38081"),
|
daemon_host: String::from("http://localhost:38081"),
|
||||||
|
i2p_proxy_host: String::from("http://localhost:4444"),
|
||||||
i2p_zero_dir: String::from("/home/user/i2p-zero-linux.v1.21"),
|
i2p_zero_dir: String::from("/home/user/i2p-zero-linux.v1.21"),
|
||||||
is_remote_node: false,
|
is_remote_node: false,
|
||||||
|
is_i2p_advanced: false,
|
||||||
mainnet: false,
|
mainnet: false,
|
||||||
monero_location: String::from("/home/user/monero-x86_64-linux-gnu-v0.18.2.2"),
|
monero_location: String::from("/home/user/monero-x86_64-linux-gnu-v0.18.2.2"),
|
||||||
rpc_credential: String::from("pass"),
|
rpc_credential: String::from("pass"),
|
||||||
|
@ -143,6 +147,7 @@ impl ReleaseEnvironment {
|
||||||
pub fn start_core(conn: &Connections) {
|
pub fn start_core(conn: &Connections) {
|
||||||
let env = if !conn.mainnet { "dev" } else { "prod" };
|
let env = if !conn.mainnet { "dev" } else { "prod" };
|
||||||
let remote_node = if !conn.is_remote_node { "--full-node" } else { "--remote-node" };
|
let remote_node = if !conn.is_remote_node { "--full-node" } else { "--remote-node" };
|
||||||
|
let i2p_advanced = if !conn.is_i2p_advanced { "--i2p-normal" } else { "--i2p-advanced" };
|
||||||
let args = [
|
let args = [
|
||||||
"--monero-location",
|
"--monero-location",
|
||||||
&conn.monero_location,
|
&conn.monero_location,
|
||||||
|
@ -160,7 +165,10 @@ pub fn start_core(conn: &Connections) {
|
||||||
&conn.i2p_zero_dir,
|
&conn.i2p_zero_dir,
|
||||||
"-r",
|
"-r",
|
||||||
env,
|
env,
|
||||||
remote_node
|
remote_node,
|
||||||
|
i2p_advanced,
|
||||||
|
"--i2p-proxy-host",
|
||||||
|
&conn.i2p_proxy_host,
|
||||||
];
|
];
|
||||||
let output = std::process::Command::new("./neveko")
|
let output = std::process::Command::new("./neveko")
|
||||||
.args(args)
|
.args(args)
|
||||||
|
@ -206,7 +214,9 @@ pub fn get_app_port() -> u16 {
|
||||||
/// i2p http proxy
|
/// i2p http proxy
|
||||||
pub fn get_i2p_http_proxy() -> String {
|
pub fn get_i2p_http_proxy() -> String {
|
||||||
let args = args::Args::parse();
|
let args = args::Args::parse();
|
||||||
args.i2p_proxy_host
|
let advanced_proxy =
|
||||||
|
std::env::var(crate::NEVEKO_I2P_PROXY_HOST).unwrap_or(empty_string());
|
||||||
|
if advanced_proxy == empty_string() { args.i2p_proxy_host } else { advanced_proxy }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// app auth port
|
/// app auth port
|
||||||
|
@ -496,7 +506,9 @@ pub async fn start_up() {
|
||||||
let wallet_password =
|
let wallet_password =
|
||||||
std::env::var(crate::MONERO_WALLET_PASSWORD).unwrap_or(String::from("password"));
|
std::env::var(crate::MONERO_WALLET_PASSWORD).unwrap_or(String::from("password"));
|
||||||
gen_app_wallet(&wallet_password).await;
|
gen_app_wallet(&wallet_password).await;
|
||||||
i2p::start().await;
|
if args.i2p_normal {
|
||||||
|
i2p::start().await;
|
||||||
|
}
|
||||||
gen_app_gpg().await;
|
gen_app_gpg().await;
|
||||||
let env: String = get_release_env().value();
|
let env: String = get_release_env().value();
|
||||||
start_gui();
|
start_gui();
|
||||||
|
|
|
@ -261,11 +261,21 @@ impl eframe::App for HomeApp {
|
||||||
ui.text_edit_singleline(&mut self.connections.i2p_zero_dir)
|
ui.text_edit_singleline(&mut self.connections.i2p_zero_dir)
|
||||||
.labelled_by(cm_i2p_dir_label.id);
|
.labelled_by(cm_i2p_dir_label.id);
|
||||||
});
|
});
|
||||||
|
ui.horizontal(|ui| {
|
||||||
|
let cm_i2p_proxy_label = ui.label("i2p proxy host: \t");
|
||||||
|
ui.text_edit_singleline(&mut self.connections.i2p_proxy_host)
|
||||||
|
.labelled_by(cm_i2p_proxy_label.id);
|
||||||
|
});
|
||||||
let mut is_remote_node = self.connections.is_remote_node;
|
let mut is_remote_node = self.connections.is_remote_node;
|
||||||
if ui.checkbox(&mut is_remote_node, "remote node").changed() {
|
if ui.checkbox(&mut is_remote_node, "remote node").changed() {
|
||||||
self.connections.is_remote_node = !self.connections.is_remote_node;
|
self.connections.is_remote_node = !self.connections.is_remote_node;
|
||||||
log::debug!("is remote node: {}", self.connections.is_remote_node);
|
log::debug!("is remote node: {}", self.connections.is_remote_node);
|
||||||
}
|
}
|
||||||
|
let mut is_i2p_advanced = self.connections.is_i2p_advanced;
|
||||||
|
if ui.checkbox(&mut is_i2p_advanced, "i2p advanced mode").changed() {
|
||||||
|
self.connections.is_i2p_advanced = !self.connections.is_i2p_advanced;
|
||||||
|
log::debug!("is i2p advanced mode: {}", self.connections.is_i2p_advanced);
|
||||||
|
}
|
||||||
// let mut is_mainnet = self.connections.mainnet;
|
// let mut is_mainnet = self.connections.mainnet;
|
||||||
// if ui.checkbox(&mut is_mainnet, "mainnet").changed() {
|
// if ui.checkbox(&mut is_mainnet, "mainnet").changed() {
|
||||||
// self.connections.mainnet = !self.connections.mainnet;
|
// self.connections.mainnet = !self.connections.mainnet;
|
||||||
|
@ -275,6 +285,8 @@ impl eframe::App for HomeApp {
|
||||||
self.is_editing_connections = false;
|
self.is_editing_connections = false;
|
||||||
utils::kill_child_processes(true);
|
utils::kill_child_processes(true);
|
||||||
utils::start_core(&self.connections);
|
utils::start_core(&self.connections);
|
||||||
|
// set the i2p proxy host for advanced user re-use
|
||||||
|
std::env::set_var(neveko_core::NEVEKO_I2P_PROXY_HOST, self.connections.i2p_proxy_host.clone());
|
||||||
self.is_loading = true;
|
self.is_loading = true;
|
||||||
start_core_timeout(self.core_timeout_tx.clone(), ctx.clone());
|
start_core_timeout(self.core_timeout_tx.clone(), ctx.clone());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue