pub struct AsyncSession<S> { /* private fields */ }

Implementations§

source§

impl<S> AsyncSession<S>where
    S: AsRawFd + 'static,

source

pub fn new(
    stream: S,
    configuration: impl Into<Option<SessionConfiguration>>
) -> Result<Self, Error>

source§

impl AsyncSession<AsyncIoTcpStream>

source

pub async fn connect<A: Into<SocketAddr>>(
    addr: A,
    configuration: impl Into<Option<SessionConfiguration>>
) -> Result<Self, Error>

source§

impl AsyncSession<AsyncIoUnixStream>

source

pub async fn connect<P: AsRef<Path>>(
    path: P,
    configuration: impl Into<Option<SessionConfiguration>>
) -> Result<Self, Error>

source§

impl AsyncSession<TokioTcpStream>

source

pub async fn connect<A: Into<SocketAddr>>(
    addr: A,
    configuration: impl Into<Option<SessionConfiguration>>
) -> Result<Self, Error>

source§

impl AsyncSession<TokioUnixStream>

source

pub async fn connect<P: AsRef<Path>>(
    path: P,
    configuration: impl Into<Option<SessionConfiguration>>
) -> Result<Self, Error>

source§

impl<S> AsyncSession<S>

source

pub fn is_blocking(&self) -> bool

source

pub fn banner(&self) -> Option<&str>

source

pub fn banner_bytes(&self) -> Option<&[u8]>

source

pub fn timeout(&self) -> u32

source§

impl<S> AsyncSession<S>where
    S: AsyncSessionStream + Send + Sync + 'static,

source

pub async fn handshake(&mut self) -> Result<(), Error>

source

pub async fn userauth_password(
    &self,
    username: &str,
    password: &str
) -> Result<(), Error>

source

pub async fn userauth_keyboard_interactive<P: KeyboardInteractivePrompt + Send>(
    &self,
    username: &str,
    prompter: &mut P
) -> Result<(), Error>

source

pub async fn userauth_agent(&self, username: &str) -> Result<(), Error>

source

pub async fn userauth_pubkey_file(
    &self,
    username: &str,
    pubkey: Option<&Path>,
    privatekey: &Path,
    passphrase: Option<&str>
) -> Result<(), Error>

source

pub async fn userauth_pubkey_memory(
    &self,
    username: &str,
    pubkeydata: Option<&str>,
    privatekeydata: &str,
    passphrase: Option<&str>
) -> Result<(), Error>

source

pub async fn userauth_hostbased_file(
    &self,
    username: &str,
    publickey: &Path,
    privatekey: &Path,
    passphrase: Option<&str>,
    hostname: &str,
    local_username: Option<&str>
) -> Result<(), Error>

source

pub fn authenticated(&self) -> bool

source

pub async fn auth_methods<'a>(&'a self, username: &'a str) -> Result<&str, Error>

source

pub async fn method_pref(
    &self,
    method_type: MethodType,
    prefs: &str
) -> Result<(), Error>

source

pub fn methods(&self, method_type: MethodType) -> Option<&str>

source

pub async fn supported_algs(
    &self,
    method_type: MethodType
) -> Result<Vec<&'static str>, Error>

source

pub fn agent(&self) -> Result<AsyncAgent<S>, Error>

source

pub fn known_hosts(&self) -> Result<KnownHosts, Error>

source

pub async fn channel_session(&self) -> Result<AsyncChannel<S>, Error>

source

pub async fn channel_direct_tcpip(
    &self,
    host: &str,
    port: u16,
    src: Option<(&str, u16)>
) -> Result<AsyncChannel<S>, Error>

source

pub async fn channel_forward_listen(
    &self,
    remote_port: u16,
    host: Option<&str>,
    queue_maxsize: Option<u32>
) -> Result<(AsyncListener<S>, u16), Error>

source

pub async fn scp_recv(
    &self,
    path: &Path
) -> Result<(AsyncChannel<S>, ScpFileStat), Error>

source

pub async fn scp_send(
    &self,
    remote_path: &Path,
    mode: i32,
    size: u64,
    times: Option<(u64, u64)>
) -> Result<AsyncChannel<S>, Error>

source

pub async fn sftp(&self) -> Result<AsyncSftp<S>, Error>

source

pub async fn channel_open(
    &self,
    channel_type: &str,
    window_size: u32,
    packet_size: u32,
    message: Option<&str>
) -> Result<AsyncChannel<S>, Error>

source

pub fn host_key(&self) -> Option<(&[u8], HostKeyType)>

source

pub fn host_key_hash(&self, hash: HashType) -> Option<&[u8]>

source

pub async fn keepalive_send(&self) -> Result<u32, Error>

source

pub async fn disconnect(
    &self,
    reason: Option<DisconnectCode>,
    description: &str,
    lang: Option<&str>
) -> Result<(), Error>

source

pub fn block_directions(&self) -> BlockDirections

source§

impl<S> AsyncSession<S>where
    S: AsyncSessionStream + Send + Sync + 'static,

source

pub async fn remote_port_forwarding(
    &self,
    remote_port: u16,
    host: Option<&str>,
    queue_maxsize: Option<u32>,
    local: ConnectInfo
) -> Result<(), Error>

source§

impl<S> AsyncSession<S>

source§

impl<S> AsyncSession<S>where
    S: AsyncSessionStream + Send + Sync + 'static,

source

pub async fn userauth_agent_with_try_next(
    &self,
    username: &str
) -> Result<(), Error>

source

pub async fn userauth_agent_with_try_next_with_callback<CB>(
    &self,
    username: &str,
    cb: CB
) -> Result<(), Error>where
    CB: FnMut(Vec<PublicKey>) -> Vec<PublicKey>,

Trait Implementations§

source§

impl<S> Clone for AsyncSession<S>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<S> !RefUnwindSafe for AsyncSession<S>

§

impl<S> Send for AsyncSession<S>where
    S: Send + Sync,

§

impl<S> Sync for AsyncSession<S>where
    S: Send + Sync,

§

impl<S> Unpin for AsyncSession<S>

§

impl<S> !UnwindSafe for AsyncSession<S>

Blanket Implementations§

source§

impl<T> Any for Twhere
    T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere
    T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere
    U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere
    T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere
    U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.