pub struct SwarmSSH { /* private fields */ }
Expand description
Connect to a remote computer via the ssh protocol.
Implementations§
source§impl SwarmSSH
impl SwarmSSH
sourcepub fn download_task<P>(&self, remote_path: P) -> QResult<DownloadTask<'_>>where
P: AsRef<Path>,
pub fn download_task<P>(&self, remote_path: P) -> QResult<DownloadTask<'_>>where
P: AsRef<Path>,
source§impl SwarmSSH
impl SwarmSSH
sourcepub fn upload_task<C, P>(
&self,
content: C,
remote_path: P
) -> QResult<UploadTask<'_>>where
P: AsRef<Path>,
ContentResolver: TryFrom<C, Error = QError>,
pub fn upload_task<C, P>(
&self,
content: C,
remote_path: P
) -> QResult<UploadTask<'_>>where
P: AsRef<Path>,
ContentResolver: TryFrom<C, Error = QError>,
Create a upload task, note that the execute command needs to be [DownloadTask::activated
]
Arguments
content
:remote_path
:
returns: Result<UploadTask, QError>
Examples
async fn test_upload() -> QResult {
let ssh = SwarmSSH::login_password("192.168.1.100:22", "root", "password").await?;
let data: &[u8] = include_bytes!("../mod.rs");
ssh.upload_task(data, "/tmp/mod.rs")?.with_permission(0o644).execute().await?;
Ok(())
}
source§impl SwarmSSH
impl SwarmSSH
sourcepub fn shell_runner(&self) -> QResult<ShellRunner<'_>>
pub fn shell_runner(&self) -> QResult<ShellRunner<'_>>
source§impl SwarmSSH
impl SwarmSSH
sourcepub async fn login_password<A>(
address: A,
user: &str,
password: &str
) -> QResult<Self>where
A: ToSocketAddrs,
pub async fn login_password<A>(
address: A,
user: &str,
password: &str
) -> QResult<Self>where
A: ToSocketAddrs,
Log in to the remote computer with username and password
Arguments
address
: The address of the remote computer, such as192.168.1.100:22
user
: The username of the remote computer, such asroot
password
: The password of the remote computer, such aspassword
Examples
async fn test_password() -> QResult<SwarmSSH> {
SwarmSSH::login_password("192.168.1.100:22", "root", "password").await
}