2026-09-10 02:49:42 -04:00
|
|
|
use onionwire::tui::AppExit;
|
|
|
|
|
|
2026-09-10 02:43:45 -04:00
|
|
|
#[tokio::main]
|
|
|
|
|
async fn main() {
|
|
|
|
|
if let Err(e) = boot().await {
|
|
|
|
|
eprintln!("onionwire: {e}");
|
|
|
|
|
std::process::exit(1);
|
2026-09-10 01:43:02 -04:00
|
|
|
}
|
2026-09-10 01:02:33 -04:00
|
|
|
}
|
2026-09-10 02:43:45 -04:00
|
|
|
|
|
|
|
|
async fn boot() -> Result<(), String> {
|
|
|
|
|
let home = onionwire::Store::home_dir().map_err(|e| e.to_string())?;
|
|
|
|
|
eprintln!("onionwire: bootstrapping Arti…");
|
2026-09-10 02:49:42 -04:00
|
|
|
let node = onionwire::node::Node::start(home.clone()).await?;
|
2026-09-10 02:43:45 -04:00
|
|
|
let handle = tokio::runtime::Handle::current();
|
2026-09-10 02:49:42 -04:00
|
|
|
let exit = tokio::task::spawn_blocking(move || onionwire::tui::run(node, handle))
|
2026-09-10 02:43:45 -04:00
|
|
|
.await
|
2026-09-10 02:49:42 -04:00
|
|
|
.map_err(|e| e.to_string())??;
|
|
|
|
|
if exit == AppExit::WipeAll {
|
|
|
|
|
onionwire::Store::wipe_all(&home).map_err(|e| e.to_string())?;
|
|
|
|
|
eprintln!("onionwire: all local data wiped");
|
|
|
|
|
}
|
|
|
|
|
Ok(())
|
2026-09-10 02:43:45 -04:00
|
|
|
}
|