Struct swarm_ssh::SwarmSSH

source ·
pub struct SwarmSSH { /* private fields */ }
Expand description

Connect to a remote computer via the ssh protocol.

Implementations§

Create a download task, note that the execute command needs to be [DownloadTask::activated]

Arguments
  • remote_path:

returns: Result<DownloadTask, QError>

Examples
use swarm_ssh::SwarmSSH;

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(())
}

Create a download task, note that the execute command needs to be [DownloadTask::activated]

Arguments
  • remote_path:

returns: Result<DownloadTask, QError>

Examples
use swarm_ssh::SwarmSSH;

Log in to the remote computer with username and password

Arguments
  • address: The address of the remote computer, such as 192.168.1.100:22
  • user: The username of the remote computer, such as root
  • password: The password of the remote computer, such as password
Examples
async fn test_password() -> QResult<SwarmSSH> {
    SwarmSSH::login_password("192.168.1.100:22", "root", "password").await
}

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.