Add authorized TCP pipe forwarding
This commit is contained in:
parent
87d8801d71
commit
6bc2666993
8 changed files with 645 additions and 81 deletions
|
|
@ -397,6 +397,16 @@ pub enum PipeCommand {
|
|||
#[arg(long)]
|
||||
bearer_secret: Option<String>,
|
||||
},
|
||||
ForwardTcp {
|
||||
#[arg(long)]
|
||||
listen: String,
|
||||
#[arg(long)]
|
||||
node: String,
|
||||
#[arg(long)]
|
||||
target: String,
|
||||
#[arg(long)]
|
||||
bearer_secret: Option<String>,
|
||||
},
|
||||
Send {
|
||||
target: String,
|
||||
message: Option<String>,
|
||||
|
|
@ -611,6 +621,20 @@ pub async fn run() -> Result<()> {
|
|||
.await
|
||||
.context("stream SSH proxy through geth daemon")?;
|
||||
}
|
||||
Command::Pipe {
|
||||
command:
|
||||
PipeCommand::ForwardTcp {
|
||||
listen,
|
||||
node,
|
||||
target,
|
||||
bearer_secret,
|
||||
},
|
||||
} if !cli.json && !cli.jsonl => {
|
||||
println!("forwarding tcp {listen} -> {node}:{target}");
|
||||
geth_node::run_tcp_forward(&paths, listen, node, target, bearer_secret)
|
||||
.await
|
||||
.context("run TCP forward through geth daemon")?;
|
||||
}
|
||||
command => {
|
||||
let request = request_for_command(command)?;
|
||||
let response = geth_node::send_control(&paths, request)
|
||||
|
|
@ -891,6 +915,17 @@ fn request_for_command(command: Command) -> Result<ControlRequest> {
|
|||
node,
|
||||
bearer_secret,
|
||||
},
|
||||
PipeCommand::ForwardTcp {
|
||||
listen,
|
||||
node,
|
||||
target,
|
||||
bearer_secret,
|
||||
} => ControlRequest::PipeTcpForward {
|
||||
listen_addr: listen,
|
||||
node,
|
||||
target_addr: target,
|
||||
bearer_secret,
|
||||
},
|
||||
PipeCommand::Send {
|
||||
target,
|
||||
message,
|
||||
|
|
|
|||
Loading…
Reference in a new issue