//! A controllable LAN peer for verifying the agent's serverless sync, without a //! second clipboard-touching process. Dead server → only the LAN transport can //! move data. //! cargo run --example lan_peer -- //! Prints `RECV ` for anything received; sends once after //! discovery settles. use std::time::Duration; use tethercore::{Engine, Message, MessageHandler}; struct Printer; impl MessageHandler for Printer { fn on_message(&self, msg: Message) { println!("RECV {}", msg.text); } fn on_status(&self, _connected: bool) {} fn on_file(&self, _name: String, _mime: String, _data: Vec) {} } fn main() { let room = std::env::args().nth(1).unwrap_or_else(|| "lan-verify".into()); let send = std::env::args().nth(2); // High `from` so it accepts the agent's dial (lower id dials). let e = Engine::new("http://127.0.0.1:1".into(), room, "zzz-peer".into(), "peer".into(), "Rust LAN Peer".into(), "".into()); e.start(Box::new(Printer)); std::thread::sleep(Duration::from_secs(6)); // let mDNS discover + TCP connect if let Some(s) = send { e.send(s); } std::thread::sleep(Duration::from_secs(8)); }