- kex
[email protected]
curve25519-sha256
ecdh-sha2-nistp256
ecdh-sha2-nistp384
ecdh-sha2-nistp521
diffie-hellman-group14-sha256
diffie-hellman-group16-sha512
diffie-hellman-group16-sha256
diffie-hellman-group14-sha1
diffie-hellman-group18-sha512
diffie-hellman-group-exchange-sha256
diffie-hellman-group-exchange-sha1
diffie-hellman-group15-sha512
diffie-hellman-group17-sha512
diffie-hellman-group1-sha1
- hostkey
ssh-ed25519
rsa-sha2-256
rsa-sha2-512
ssh-rsa
ssh-dss
ecdsa-sha2-nistp521
ecdsa-sha2-nistp256
ecdsa-sha2-nistp384
- encryption
[email protected]
[email protected]
[email protected]
aes256-ctr
aes128-cbc
aes192-cbc
aes256-cbc
aes128-ctr
aes192-ctr
[email protected]
3des-cbc
- mac
hmac-sha1
[email protected]
hmac-sha1-96
[email protected]
hmac-md5
[email protected]
hmac-md5-96
[email protected]
hmac-sha2-512
[email protected]
hmac-sha2-256
[email protected]
- compress
zlib
[email protected]
- echo hello
#[tokio::main]
async fn main() {
use flatline::session::Session;
use flatline::handshake::Config;
use tokio::net::TcpStream;
use flatline::session::Userauth;
use flatline::channel::ExitStatus;
let socket = TcpStream::connect("192.168.8.190:22").await.unwrap();
let config = Config::deafult_with_behavior();
let session = Session::handshake(config, socket).await.unwrap();
let status = session.userauth_password("zhou", "123456").await.unwrap();
assert!(matches!(status, Userauth::Success));
let mut channel = session.channel_open_default().await.unwrap();
channel.exec("echo \"hello\"").await.unwrap();
loop {
let msg = channel.recv().await.unwrap();
match msg {
flatline::channel::Message::Close => break,
flatline::channel::Message::Eof => break,
flatline::channel::Message::Stdout(data) => assert_eq!(data, b"hello\n"),
flatline::channel::Message::Stderr(_) => unreachable!(),
flatline::channel::Message::Exit(status) => assert!(matches!(status, ExitStatus::Normal(0))),
}
}
}
Warning
flatline is beta now and can contain breaking changes!