Connect pipes over Iroh control
This commit is contained in:
parent
e294965833
commit
741bd202a8
8 changed files with 344 additions and 32 deletions
|
|
@ -325,8 +325,14 @@ pub enum PubsubCommand {
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
pub enum PipeCommand {
|
||||
Listen { name: String },
|
||||
Connect { target: String },
|
||||
Listen {
|
||||
name: String,
|
||||
},
|
||||
Connect {
|
||||
target: String,
|
||||
#[arg(long)]
|
||||
node: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
#[derive(Debug, Subcommand)]
|
||||
|
|
@ -644,7 +650,7 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
},
|
||||
Command::Pipe { command } => match command {
|
||||
PipeCommand::Listen { name } => ControlRequest::PipeListen { name },
|
||||
PipeCommand::Connect { target } => ControlRequest::PipeConnect { target },
|
||||
PipeCommand::Connect { target, node } => ControlRequest::PipeConnect { target, node },
|
||||
},
|
||||
Command::Db { command } => match command {
|
||||
DbCommand::Add { name, path } => ControlRequest::DbAdd { name, path },
|
||||
|
|
@ -1422,6 +1428,29 @@ fn print_response(response: ControlResponse, json: bool) -> Result<()> {
|
|||
println!("connected_at_ms: {}", connection.connected_at.0);
|
||||
println!("note: {}", connection.note);
|
||||
}
|
||||
ControlResponse::PipeRemoteConnected {
|
||||
peer_node_id,
|
||||
peer_agent_id,
|
||||
endpoint_id,
|
||||
connection,
|
||||
allowed,
|
||||
reason,
|
||||
note,
|
||||
} => {
|
||||
if allowed {
|
||||
println!("pipe target: {}", connection.target);
|
||||
println!("peer: {peer_node_id}");
|
||||
println!("remote_listener_found: {}", connection.local_listener_found);
|
||||
println!("connected_at_ms: {}", connection.connected_at.0);
|
||||
} else {
|
||||
println!("pipe connect denied by {peer_node_id}");
|
||||
}
|
||||
println!("agent: {peer_agent_id}");
|
||||
println!("endpoint: {endpoint_id}");
|
||||
println!("allowed: {allowed}");
|
||||
println!("reason: {reason}");
|
||||
println!("note: {note}");
|
||||
}
|
||||
ControlResponse::NotImplemented { module, command } => {
|
||||
println!("{module} {command}: not implemented yet");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue