Struct thrussh_client::Client [] [src]

pub struct Client<Stream> {
    pub connection: Connection,
    // some fields omitted


connection: Connection


impl Client<()>

fn new() -> Self

Create a client, allocating a Poll and an SSH client configuration.

fn default_ssh_config(&mut self) -> Result<Option<SocketAddr>, ClientError>

Parse the ssh config file, from its default location (~/.ssh/config on Unix, and %USERPROFILE%/ssh/config on Windows.

use thrussh_client::*;

fn ssh_config<P: AsRef<Path>>(&mut self, path: P) -> Result<Option<SocketAddr>, ClientError>

Read an SSH configuration file from a custom path.

fn set_host(&mut self, host: &str)

Set the host name, replacing any previously set name. This can be a name from the config file.

fn set_port(&mut self, port: u16)

Set the port.

fn connect(self) -> Result<Client<BufReader<TcpStream>>, ClientError>

Connect this client.

impl Client<BufReader<TcpStream>>

fn authenticate(&mut self) -> Result<Option<PublicKey>, ClientError>

Attempt (or re-attempt) authentication. Returns Ok(Some(…)) if the server's host key is unknown, Ok(None) if authentication succeeded, and errors in all other cases.

fn learn_host(&self, key: &PublicKey) -> Result<()ClientError>

Write the host into the known_hosts file.

fn wait_channel_open<C: Handler>(&mut self, c: &mut C, channel: u32) -> Result<()ClientError>

Waiting until the given channel is open.

fn wait_channel_close<C: Handler>(&mut self, c: &mut C, channel: u32) -> Result<()ClientError>

Waiting until the given channel is closed by the remote side.

fn run_until<R: Handler, F: Fn(&mut R) -> bool>(&mut self, client: &mut R, until: F) -> Result<()ClientError>

Run the protocol until some condition is satisfied on the client.

Methods from Deref<Target=Connection>

fn read<R, C>(&mut self, client: &mut C, stream: &mut R, buffer: &mut CryptoBuf, buffer2: &mut CryptoBuf) -> Result<boolError> where C: Handler, R: BufRead

Process all packets available in the buffer, and returns whether at least one complete packet was read. buffer and buffer2 are work spaces mostly used to compute keys. They are cleared before using, hence nothing is expected from them.

fn write<W>(&mut self, stream: &mut W) -> Result<boolError> where W: Write

Write all computed packets to the stream. Returns whether all packets have been sent.

Trait Implementations

impl<T> Deref for Client<T>

type Target = Connection

The resulting type after dereferencing

fn deref(&self) -> &Connection

The method called to dereference a value

impl<T> DerefMut for Client<T>

fn deref_mut(&mut self) -> &mut Connection

The method called to mutably dereference a value