forked from mincomk/rsh
feat: rshc: add sshserve
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user