Skip to content

Commit

Permalink
add x11 support to ssh proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
lyang2821 committed Oct 19, 2024
1 parent fd7c918 commit a6644f4
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lapdev-proxy-ssh/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,31 @@ impl russh::server::Handler for SshProxyHandler {

Ok(true)
}

async fn channel_open_x11(
&mut self,
channel: Channel<Msg>,
originator_address: &str,
originator_port: u32,
session: &mut Session,
) -> Result<bool, Self::Error> {
let ws_session = self
.ws_session
.as_mut()
.ok_or_else(|| anyhow!("don't have ws session"))?;
let ws_channel = ws_session
.handle
.channel_open_x11(originator_address, originator_port)
.await?;

let server_handle = session.handle();

tokio::spawn(async move {
let _ = forward_server_client(channel, ws_channel, server_handle).await;
});

Ok(true)
}
}

async fn forward_server_client(
Expand Down

0 comments on commit a6644f4

Please sign in to comment.