Removed filetransfer module; migrated to remotefs crate

This commit is contained in:
veeso
2021-12-09 18:07:36 +01:00
committed by Christian Visintin
parent 25dd1b9b0a
commit df7a4381c4
60 changed files with 1185 additions and 6814 deletions

View File

@@ -28,8 +28,9 @@
// Locals
use super::config_client::ConfigClient;
// Ext
use remotefs::client::ssh::SshKeyStorage as SshKeyStorageT;
use std::collections::HashMap;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
pub struct SshKeyStorage {
hosts: HashMap<String, PathBuf>, // Association between {user}@{host} and RSA key path
@@ -74,14 +75,6 @@ impl SshKeyStorage {
}
}
/// ### resolve
///
/// Return RSA key path from host and username
pub fn resolve(&self, host: &str, username: &str) -> Option<&PathBuf> {
let key: String = Self::make_mapkey(host, username);
self.hosts.get(&key)
}
/// ### make_mapkey
///
/// Make mapkey from host and username
@@ -100,6 +93,13 @@ impl SshKeyStorage {
}
}
impl SshKeyStorageT for SshKeyStorage {
fn resolve(&self, host: &str, username: &str) -> Option<&Path> {
let key: String = Self::make_mapkey(host, username);
self.hosts.get(&key).map(|x| x.as_path())
}
}
#[cfg(test)]
mod tests {