structure

This commit is contained in:
enx01
2025-11-27 00:03:29 +01:00
parent 8c8dbadf18
commit f681b94d5e
22 changed files with 4880 additions and 157 deletions

36
client-gui/src/main.rs Normal file
View File

@@ -0,0 +1,36 @@
use client_network::{start_p2p_executor, NetworkCommand, NetworkEvent};
use crate::gui_app::P2PClientApp;
mod gui_app;
#[tokio::main]
async fn main() -> eframe::Result<()> {
// 1. Setup Channels
let (network_cmd_tx, network_cmd_rx) = crossbeam_channel::unbounded::<NetworkCommand>();
let (network_event_tx, network_event_rx) = crossbeam_channel::unbounded::<NetworkEvent>();
// 2. Start the P2P Network Executor in a separate Tokio task
// The executor runs in the background of our main async runtime.
let _network_handle = start_p2p_executor(network_cmd_rx, network_event_tx);
// 3. Configure and Run the Eframe/Egui GUI
let options = eframe::NativeOptions {
viewport: egui::ViewportBuilder::default()
.with_inner_size([1000.0, 700.0])
.with_min_inner_size([700.0, 500.0])
.with_icon(
eframe::icon_data::from_png_bytes(include_bytes!("../assets/icon.png"))
.expect("Failed to load icon"),
),
..Default::default()
};
eframe::run_native(
"Rust P2P Client (Merkle Tree Sync)",
options,
Box::new(|cc| {
let app = P2PClientApp::new(network_cmd_tx, network_event_rx);
Ok(Box::new(app))
}),
)
}