pub struct Session { /* private fields */ }
Expand description
See Session
.
Implementations§
Source§impl Session
impl Session
See set_banner
.
Sourcepub fn set_allow_sigpipe(&self, block: bool)
pub fn set_allow_sigpipe(&self, block: bool)
See set_allow_sigpipe
.
Sourcepub fn set_compress(&self, compress: bool)
pub fn set_compress(&self, compress: bool)
See set_allow_sigpipe
.
Sourcepub fn is_blocking(&self) -> bool
pub fn is_blocking(&self) -> bool
See is_blocking
.
Sourcepub fn set_timeout(&self, timeout_ms: u32)
pub fn set_timeout(&self, timeout_ms: u32)
See set_timeout
.
Sourcepub fn set_tcp_stream(&mut self, stream: Async<TcpStream>) -> Result<(), Error>
pub fn set_tcp_stream(&mut self, stream: Async<TcpStream>) -> Result<(), Error>
Sets the tcp stream for the underlying ssh2
lib.
use async_ssh2::Session;
use std::net::TcpStream;
use smol::Async;
#[tokio::main]
async fn main() {
let stream = Async::<TcpStream>::connect("127.0.0.1:22").await.unwrap();
let mut sess = async_ssh2::Session::new().unwrap();
sess.set_tcp_stream(stream).unwrap();
}
Sourcepub async fn userauth_password(
&self,
username: &str,
password: &str,
) -> Result<(), Error>
pub async fn userauth_password( &self, username: &str, password: &str, ) -> Result<(), Error>
See userauth_password
.
Sourcepub fn userauth_keyboard_interactive<P: KeyboardInteractivePrompt>(
&self,
_username: &str,
_prompter: &mut P,
) -> Result<(), Error>
pub fn userauth_keyboard_interactive<P: KeyboardInteractivePrompt>( &self, _username: &str, _prompter: &mut P, ) -> Result<(), Error>
Sourcepub async fn userauth_agent(&self, username: &str) -> Result<(), Error>
pub async fn userauth_agent(&self, username: &str) -> Result<(), Error>
See userauth_agent
.
Sourcepub async fn userauth_pubkey_file(
&self,
username: &str,
pubkey: Option<&Path>,
privatekey: &Path,
passphrase: Option<&str>,
) -> Result<(), Error>
pub async fn userauth_pubkey_file( &self, username: &str, pubkey: Option<&Path>, privatekey: &Path, passphrase: Option<&str>, ) -> Result<(), Error>
See userauth_pubkey_file
.
Sourcepub async fn userauth_pubkey_memory(
&self,
username: &str,
pubkeydata: Option<&str>,
privatekeydata: &str,
passphrase: Option<&str>,
) -> Result<(), Error>
pub async fn userauth_pubkey_memory( &self, username: &str, pubkeydata: Option<&str>, privatekeydata: &str, passphrase: Option<&str>, ) -> Result<(), Error>
Sourcepub async fn userauth_hostbased_file(
&self,
username: &str,
publickey: &Path,
privatekey: &Path,
passphrase: Option<&str>,
hostname: &str,
local_username: Option<&str>,
) -> Result<(), Error>
pub async fn userauth_hostbased_file( &self, username: &str, publickey: &Path, privatekey: &Path, passphrase: Option<&str>, hostname: &str, local_username: Option<&str>, ) -> Result<(), Error>
Sourcepub fn authenticated(&self) -> bool
pub fn authenticated(&self) -> bool
See authenticated
.
Sourcepub async fn auth_methods(&self, username: &str) -> Result<&str, Error>
pub async fn auth_methods(&self, username: &str) -> Result<&str, Error>
See auth_methods
.
Sourcepub fn method_pref(
&self,
method_type: MethodType,
prefs: &str,
) -> Result<(), Error>
pub fn method_pref( &self, method_type: MethodType, prefs: &str, ) -> Result<(), Error>
See method_pref
.
Sourcepub fn supported_algs(
&self,
method_type: MethodType,
) -> Result<Vec<&'static str>, Error>
pub fn supported_algs( &self, method_type: MethodType, ) -> Result<Vec<&'static str>, Error>
See supported_algs
.
Sourcepub fn known_hosts(&self) -> Result<KnownHosts, Error>
pub fn known_hosts(&self) -> Result<KnownHosts, Error>
See known_hosts
.
Sourcepub async fn channel_session(&self) -> Result<Channel, Error>
pub async fn channel_session(&self) -> Result<Channel, Error>
See channel_session
.
Sourcepub async fn channel_direct_tcpip(
&self,
host: &str,
port: u16,
src: Option<(&str, u16)>,
) -> Result<Channel, Error>
pub async fn channel_direct_tcpip( &self, host: &str, port: u16, src: Option<(&str, u16)>, ) -> Result<Channel, Error>
See channel_direct_tcpip
.
Sourcepub async fn channel_forward_listen(
&self,
remote_port: u16,
host: Option<&str>,
queue_maxsize: Option<u32>,
) -> Result<(Listener, u16), Error>
pub async fn channel_forward_listen( &self, remote_port: u16, host: Option<&str>, queue_maxsize: Option<u32>, ) -> Result<(Listener, u16), Error>
Sourcepub async fn scp_recv(
&self,
path: &Path,
) -> Result<(Channel, ScpFileStat), Error>
pub async fn scp_recv( &self, path: &Path, ) -> Result<(Channel, ScpFileStat), Error>
See scp_recv
.
Sourcepub async fn scp_send(
&self,
remote_path: &Path,
mode: i32,
size: u64,
times: Option<(u64, u64)>,
) -> Result<Channel, Error>
pub async fn scp_send( &self, remote_path: &Path, mode: i32, size: u64, times: Option<(u64, u64)>, ) -> Result<Channel, Error>
See scp_send
.
Sourcepub async fn channel_open(
&self,
channel_type: &str,
window_size: u32,
packet_size: u32,
message: Option<&str>,
) -> Result<Channel, Error>
pub async fn channel_open( &self, channel_type: &str, window_size: u32, packet_size: u32, message: Option<&str>, ) -> Result<Channel, Error>
See channel_open
.
See banner
.
See banner_bytes
.
Sourcepub fn host_key_hash(&self, hash: HashType) -> Option<&[u8]>
pub fn host_key_hash(&self, hash: HashType) -> Option<&[u8]>
See host_key_hash
.
Sourcepub fn set_keepalive(&self, want_reply: bool, interval: u32)
pub fn set_keepalive(&self, want_reply: bool, interval: u32)
See set_keepalive
.
Sourcepub async fn keepalive_send(&self) -> Result<u32, Error>
pub async fn keepalive_send(&self) -> Result<u32, Error>
See keepalive_send
.
Sourcepub async fn disconnect(
&self,
reason: Option<DisconnectCode>,
description: &str,
lang: Option<&str>,
) -> Result<(), Error>
pub async fn disconnect( &self, reason: Option<DisconnectCode>, description: &str, lang: Option<&str>, ) -> Result<(), Error>
See disconnect
.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Session
impl !RefUnwindSafe for Session
impl Send for Session
impl Sync for Session
impl Unpin for Session
impl !UnwindSafe for Session
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more