diff options
author | Toby Vincent <tobyv13@gmail.com> | 2023-03-19 21:38:46 -0500 |
---|---|---|
committer | Toby Vincent <tobyv13@gmail.com> | 2023-03-19 21:38:46 -0500 |
commit | 82598a3adc9d950c34346ccd0128d6ef78bbb437 (patch) | |
tree | f98fe22afd44a759556c1bb68c7f73d8593c8d6e /src/ssh.rs | |
parent | 928995171b8f3f19df96cfd5870f7e88f11c3978 (diff) |
fix: impl From<String> for Session for `Discovered` sessions
Diffstat (limited to 'src/ssh.rs')
-rw-r--r-- | src/ssh.rs | 14 |
1 files changed, 2 insertions, 12 deletions
@@ -1,9 +1,7 @@ -use std::time::{SystemTime, UNIX_EPOCH}; - use directories::UserDirs; use ssh2::KnownHostFileKind; -use crate::{Session, SessionSource, State}; +use crate::{Session, SessionSource}; impl SessionSource for ssh2::Session { type Error = ssh2::Error; @@ -11,10 +9,6 @@ impl SessionSource for ssh2::Session { type Iter = Vec<Session>; fn sessions(&self) -> Result<Self::Iter, Self::Error> { - let timestamp = SystemTime::now() - .duration_since(UNIX_EPOCH) - .expect("Current time is pre-epoch. (Time traveler?)"); - let mut known_hosts = self.known_hosts()?; let file = UserDirs::new() @@ -28,11 +22,7 @@ impl SessionSource for ssh2::Session { .hosts()? .into_iter() .filter_map(|h| match h.name() { - Some(name) => Some(Session { - state: State::Discovered, - timestamp, - name: name.to_owned(), - }), + Some(name) => Some(name.to_owned().into()), None => { tracing::warn!("Invalid host: No plain text host name exists"); None |