SshOpts

Struct SshOpts 

Source
pub struct SshOpts { /* private fields */ }
Expand description

Ssh options; used to build and configure SCP/SFTP client.

§Conflict resolution

You may specify some options that can be in conflict (e.g. port and Port parameter in ssh configuration). In these cases, the resolution is performed in this order (from highest, to lower priority):

  1. SshOpts attribute (e.g. port or username)
  2. Ssh configuration

This applies also to ciphers and key exchange methods.

Implementations§

Source§

impl SshOpts

Source

pub fn new<S: AsRef<str>>(host: S) -> Self

Initialize SshOpts. You must define the host you want to connect to. Host may be resolved by ssh configuration, if specified.

Other options can be specified with other constructors.

Source

pub fn port(self, port: u16) -> Self

Specify the port the remote server is listening to. This option will override an eventual port specified for the current host in the ssh configuration

Source

pub fn username<S: AsRef<str>>(self, username: S) -> Self

Set username to log in as This option will override an eventual username specified for the current host in the ssh configuration

Source

pub fn password<S: AsRef<str>>(self, password: S) -> Self

Set password to authenticate with

Source

pub fn connection_timeout(self, timeout: Duration) -> Self

Set connection timeout This option will override an eventual connection timeout specified for the current host in the ssh configuration

Source

pub fn ssh_agent_identity( self, ssh_agent_identity: Option<SshAgentIdentity>, ) -> Self

Set configuration for ssh agent

If None the ssh agent will be disabled

If Some(SshAgentIdentity::All) all identities will be tried Otherwise the provided public key will be used

Source

pub fn config_file<P: AsRef<Path>>(self, p: P, rules: ParseRule) -> Self

Set SSH configuration file to read

The supported options are:

  • Host block
  • HostName
  • Port
  • User
  • Ciphers
  • MACs
  • KexAlgorithms
  • HostKeyAlgorithms
  • ConnectionAttempts
  • ConnectTimeout
Source

pub fn key_storage(self, storage: Box<dyn SshKeyStorage>) -> Self

Set key storage to read RSA keys from

Source

pub fn method(self, method: KeyMethod) -> Self

Add key method to ssh options

Trait Implementations§

Source§

impl From<SshOpts> for ScpFs<LibSsh2Session>

Source§

fn from(opts: SshOpts) -> Self

Converts to this type from the input type.
Source§

impl From<SshOpts> for ScpFs<LibSshSession>

Source§

fn from(opts: SshOpts) -> Self

Converts to this type from the input type.
Source§

impl From<SshOpts> for SftpFs<LibSsh2Session>

Source§

fn from(opts: SshOpts) -> Self

Converts to this type from the input type.
Source§

impl From<SshOpts> for SftpFs<LibSshSession>

Source§

fn from(opts: SshOpts) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.