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):
SshOpts
attribute (e.g.port
orusername
)- Ssh configuration
This applies also to ciphers and key exchange methods.
Implementations§
Source§impl SshOpts
impl SshOpts
Sourcepub fn new<S: AsRef<str>>(host: S) -> Self
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.
Sourcepub fn port(self, port: u16) -> Self
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
Sourcepub fn username<S: AsRef<str>>(self, username: S) -> Self
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
Sourcepub fn connection_timeout(self, timeout: Duration) -> Self
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
Sourcepub fn ssh_agent_identity(
self,
ssh_agent_identity: Option<SshAgentIdentity>,
) -> Self
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
Sourcepub fn config_file<P: AsRef<Path>>(self, p: P, rules: ParseRule) -> Self
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
Sourcepub fn key_storage(self, storage: Box<dyn SshKeyStorage>) -> Self
pub fn key_storage(self, storage: Box<dyn SshKeyStorage>) -> Self
Set key storage to read RSA keys from