From 9453879e1d7a573ddb46efc27e7065e441594e7c Mon Sep 17 00:00:00 2001 From: Eugene Date: Thu, 13 Feb 2025 15:58:20 +0100 Subject: [PATCH] fmt --- warpgate-protocol-ssh/src/client/handler.rs | 6 +++--- warpgate-protocol-ssh/src/server/russh_handler.rs | 12 ++++++++++-- warpgate-protocol-ssh/src/server/session.rs | 8 +++----- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/warpgate-protocol-ssh/src/client/handler.rs b/warpgate-protocol-ssh/src/client/handler.rs index 6693678f..a1680afa 100644 --- a/warpgate-protocol-ssh/src/client/handler.rs +++ b/warpgate-protocol-ssh/src/client/handler.rs @@ -168,9 +168,9 @@ impl russh::client::Handler for ClientHandler { channel: Channel, _session: &mut Session, ) -> Result<(), Self::Error> { - let _ = self.event_tx.send(ClientHandlerEvent::ForwardedAgent( - channel, - )); + let _ = self + .event_tx + .send(ClientHandlerEvent::ForwardedAgent(channel)); Ok(()) } } diff --git a/warpgate-protocol-ssh/src/server/russh_handler.rs b/warpgate-protocol-ssh/src/server/russh_handler.rs index f9613470..926c6812 100644 --- a/warpgate-protocol-ssh/src/server/russh_handler.rs +++ b/warpgate-protocol-ssh/src/server/russh_handler.rs @@ -1,4 +1,5 @@ use std::fmt::Debug; + use bytes::Bytes; use russh::keys::PublicKey; use russh::server::{Auth, Handle, Msg, Session}; @@ -517,9 +518,16 @@ impl russh::server::Handler for ServerHandler { Ok(allowed) } - async fn agent_request(&mut self, channel: ChannelId, session: &mut Session) -> Result { + async fn agent_request( + &mut self, + channel: ChannelId, + session: &mut Session, + ) -> Result { let (tx, rx) = oneshot::channel(); - self.send_event(ServerHandlerEvent::AgentForward(ServerChannelId(channel), tx))?; + self.send_event(ServerHandlerEvent::AgentForward( + ServerChannelId(channel), + tx, + ))?; let allowed = rx.await.unwrap_or(false); if allowed { session.request_success() diff --git a/warpgate-protocol-ssh/src/server/session.rs b/warpgate-protocol-ssh/src/server/session.rs index 7d0ceab2..aa8b27f8 100644 --- a/warpgate-protocol-ssh/src/server/session.rs +++ b/warpgate-protocol-ssh/src/server/session.rs @@ -581,7 +581,7 @@ impl ServerSession { let _ = reply.send(true); } - ServerHandlerEvent::AgentForward(channel,reply) => { + ServerHandlerEvent::AgentForward(channel, reply) => { self._agent_forward(channel).await?; let _ = reply.send(true); } @@ -873,9 +873,7 @@ impl ServerSession { } RCEvent::ForwardedAgent(id) => { if let Some(session) = &mut self.session_handle { - let server_channel = session - .channel_open_agent() - .await?; + let server_channel = session.channel_open_agent().await?; self.channel_map .insert(ServerChannelId(server_channel.id()), id); @@ -1271,7 +1269,7 @@ impl ServerSession { channel_id, ChannelOperation::AgentForward, )) - .await?; + .await?; Ok(()) }