Hi there,
Actually, I'd like to build an ssh wasm application and found this crate, which is closest to what I need
But the problem is that wasm needs a websocket and in order not to break the existing logic, it needs to be asynchronous.
So I'm going to change this
pub struct Client {
pub(crate) stream: TcpStream,
pub(crate) sequence: Sequence,
pub(crate) timeout: Timeout,
pub(crate) encryption: Option<Box<dyn Encryption>>,
pub(crate) is_encryption: bool,
pub(crate) session_id: Vec<u8>,
}
To
use tokio::io::{AsyncRead, AsyncWrite};
pub struct Client<S>
where
S: AsyncRead + AsyncWrite + Unpin,
{
pub(crate) stream: S,
pub(crate) sequence: Sequence,
pub(crate) timeout: Timeout,
pub(crate) encryption: Option<Box<dyn Encryption>>,
pub(crate) is_encryption: bool,
pub(crate) session_id: Vec<u8>,
}
Just like my own crate vnc-rs does
But these changes seemed huge, so I decided to start with cargo clippy & fmt on the existing code while getting the tests for cargo all successful.
As fmt can be a real turn-off for code reviews, I made a separate commit of fmt and the other containing just the clippy results.
Hope this is helpful to you.
$ cargo clippy --fix
Checking ssh-rs v0.2.1 (/home/my/projects/ssh-rs)
Finished dev [unoptimized + debuginfo] target(s) in 1.77s
$ cargo test
Compiling ssh-rs v0.2.1 (/home/my/projects/ssh-rs)
Finished test [unoptimized + debuginfo] target(s) in 0.78s
Running unittests src/lib.rs (target/debug/deps/ssh_rs-bd2d7b9dabb611b3)
running 0 tests
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
Doc-tests ssh-rs
running 8 tests
test src/lib.rs - (line 9) - compile ... ok
test src/lib.rs - (line 49) - compile ... ok
test src/lib.rs - (line 33) - compile ... ok
test src/lib.rs - (line 21) - compile ... ok
test src/lib.rs - (line 137) - compile ... ok
test src/lib.rs - (line 103) - compile ... ok
test src/lib.rs - (line 84) - compile ... ok
test src/lib.rs - (line 65) - compile ... ok
test result: ok. 8 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.04s
BRs