use serde::{ Deserialize, Serialize };
#[derive(Debug, Serialize, Deserialize)]
pub struct ConnectInfo
{
host: String,
port: Option<u16>,
user: Option<String>,
password: Option<String>,
identity_file: Option<String>,
}
impl ConnectInfo
{
pub fn host( &self ) -> String
{
self.host.clone()
}
pub fn port( &self ) -> u16
{
self.port.unwrap_or(22)
}
pub fn user( &self ) -> String
{
self.user.clone().unwrap_or("".to_string())
}
pub fn password( &self ) -> String
{
self.password.clone().unwrap_or("".to_string())
}
pub fn identity_file( &self ) -> String
{
self.identity_file
.clone()
.unwrap_or("".to_string())
.trim_end_matches("/")
.to_string()
}
}