Add Iroh peer ping

This commit is contained in:
Eric Wendland 2026-05-18 12:09:50 +02:00
commit 679eeb48a3
15 changed files with 619 additions and 18 deletions

View file

@ -137,6 +137,9 @@ pub enum PeerCommand {
path: PathBuf,
},
List,
Ping {
node: String,
},
}
#[derive(Debug, Subcommand)]
@ -460,6 +463,7 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
PeerCommand::Export { out } => ControlRequest::PeerCardExport { out },
PeerCommand::Import { path } => ControlRequest::PeerCardImport { path },
PeerCommand::List => ControlRequest::PeerCardList,
PeerCommand::Ping { node } => ControlRequest::PeerPing { node },
},
Command::Resource {
command: ResourceCommand::List,
@ -802,6 +806,19 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
}
println!("note: {note}");
}
ControlResponse::PeerPinged {
peer_node_id,
peer_agent_id,
endpoint_id,
alpn,
note,
} => {
println!("peer pong: {peer_node_id}");
println!("agent: {peer_agent_id}");
println!("endpoint: {endpoint_id}");
println!("alpn: {alpn}");
println!("note: {note}");
}
ControlResponse::ResourceList { resources } => {
if resources.is_empty() {
println!("no resources");