feat: rshc: add sshserve

This commit is contained in:
200mill
2026-07-04 02:32:54 +09:00
parent 4e515ba964
commit 45554836d8
6 changed files with 1860 additions and 134 deletions

View File

@@ -26,6 +26,7 @@ enum Cmd {
Connect(ConnectArgs),
#[command(alias = "sh")]
Shell(ShellArgs),
ServeSsh(ServeSshArgs),
Keys(KeysCmd),
}
@@ -97,6 +98,20 @@ struct ShellArgs {
no_pty: bool,
}
#[derive(Args, Debug)]
struct ServeSshArgs {
session: String,
#[arg(short = 'h', long, default_value = "127.0.0.1")]
listen_host: String,
#[arg(short = 'p', long, default_value_t = 2222)]
listen_port: u16,
#[arg(long)]
connection: Option<u64>,
#[arg(long)]
shell: Option<String>,
}
#[derive(Args, Debug)]
struct KeysCmd {
#[command(subcommand)]
@@ -163,6 +178,8 @@ async fn run() -> Result<()> {
},
Cmd::Connect(a) => cmd::connect::run(&client, a.session, a.connection_id, a.no_pty).await,
Cmd::Shell(a) => cmd::shell::run(&client, a.session, a.connection, a.shell, a.no_pty).await,
Cmd::ServeSsh(a) => cmd::serve_ssh::run(cfg, client, a.session, a.listen_host, a.listen_port, a.connection, a.shell).await,
Cmd::Keys(k) => match k.sub {
KeysSub::Append { key, file, url } => cmd::keys::append(&client, key, file, url).await,
KeysSub::Rm { key, file, url } => cmd::keys::remove(&client, key, file, url).await,