mirror of
https://github.com/warp-tech/warpgate.git
synced 2025-09-12 01:24:24 +08:00
fmt
This commit is contained in:
parent
e2036886fb
commit
9453879e1d
3 changed files with 16 additions and 10 deletions
|
@ -168,9 +168,9 @@ impl russh::client::Handler for ClientHandler {
|
|||
channel: Channel<Msg>,
|
||||
_session: &mut Session,
|
||||
) -> Result<(), Self::Error> {
|
||||
let _ = self.event_tx.send(ClientHandlerEvent::ForwardedAgent(
|
||||
channel,
|
||||
));
|
||||
let _ = self
|
||||
.event_tx
|
||||
.send(ClientHandlerEvent::ForwardedAgent(channel));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<bool, Self::Error> {
|
||||
async fn agent_request(
|
||||
&mut self,
|
||||
channel: ChannelId,
|
||||
session: &mut Session,
|
||||
) -> Result<bool, Self::Error> {
|
||||
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()
|
||||
|
|
|
@ -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(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue