-
-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to serve basic shell request using russh #162
Comments
Your approach in general is ok. You can't use |
I see. I was thinking I could do something like tokio::io::copy(channel, master)
tokio::io::copy(master, channel) Because tokio::io::copy does io copy with AsyncRead and AsyncWrite streams. But master does not support AsyncRead nor AsyncWrite, and as you noted channel cannot be split so the borrow checker would complain. |
In fact it seems like tokio has a tutorial somewhat related to your suggestion on manual copy. |
Hi there, I'd like propose a feature related to this issue, for context I'm trying to create a git SSH remote with
I'd like to propose to work on a impl Channel {
pub fn into_io_parts(self) -> (ChannelTx, ChannelRx) {
/* ... */
}
}
impl AsyncWrite for ChannelTx {/* ... */}
impl AsyncRead for ChannelRx {/* ... */} method to solve both of these problems. Then a basic I/O bidirectional stream could be established with let child = Command::new("cat").spawn();
let (mut tx, mut rx) = channel.into_io_parts();
tokio::try_join!(
tokio::io::copy(&mut child.stdout.expect("Missing stdout"), &mut tx),
tokio::io::copy(&mut rx, &mut child.stdin.expect("Missing stdin")),
).await.expect("Copy failed !"); Would you be open to this contribution ? |
Hi all,
I am trying to write a very basic ssh daemon. Essentially what it does is
Here is my approach so far. I will
The above code won't compile because channel does not implement the Read and Write functions for io::copy.
My questions are
The text was updated successfully, but these errors were encountered: