proxmox-backup/src/bin/upload-speed.rs

35 lines
742 B
Rust
Raw Normal View History

use failure::*;
use proxmox_backup::client::*;
async fn upload_speed() -> Result<usize, Error> {
let host = "localhost";
let datastore = "store2";
let username = "root@pam";
let client = HttpClient::new(host, username, None)?;
let backup_time = chrono::Utc::now();
let client = BackupWriter::start(client, datastore, "host", "speedtest", backup_time, false).await?;
2019-05-23 05:20:05 +00:00
println!("start upload speed test");
let res = client.upload_speedtest().await?;
Ok(res)
}
#[tokio::main]
async fn main() {
match upload_speed().await {
Ok(mbs) => {
println!("average upload speed: {} MB/s", mbs);
}
Err(err) => {
eprintln!("ERROR: {}", err);
}
}
}