feat: terminal proxy

This commit is contained in:
2024-12-21 18:01:41 +00:00
parent 8641eeeca8
commit 3e7e0a789b
9 changed files with 377 additions and 77 deletions

View File

@ -1,5 +1,6 @@
use anyhow::Result;
use log::info;
use ssh2::Channel;
use std::io::Read;
use std::path::PathBuf;
use tokio::net::{TcpStream, ToSocketAddrs};
@ -28,6 +29,11 @@ impl SshClient {
Ok(())
}
pub async fn open_channel(&mut self) -> Result<Channel> {
let channel = self.session.channel_session()?;
Ok(channel)
}
pub async fn execute(&mut self, command: &str) -> Result<(i32, String)> {
info!("Executing command: {}", command);
let mut channel = self.session.channel_session()?;