pub struct FilesystemMountDefinition {
pub id: String,
pub host: String,
pub port: u16,
pub user: String,
pub mount_options: Vec<String>,
pub remote_path: String,
pub mount_dest_path: Option<String>,
pub cmd_before_mount: String,
pub auth_type: AuthType,
pub ssh_key: String,
}Fields§
§id: StringUnique identifier for this definition.
If mount_dest_path is None, this will also influence where the filesystem gets mounted locally (see local_mount_path()).
host: StringHostname or IP address of the remote machine
port: u16Port number of the remote machine (e.g. 22).
user: StringUsername to SSH in on the remote machine (e.g. user).
mount_options: Vec<String>Mount options to pass to sshfs (-o).
Example: [follow_symlinks, rename]
remote_path: StringPath on the remote server that will be mounted locally (e.g. /storage).
mount_dest_path: Option<String>Path where the filesystem will be mounted locally (e.g. /home/user/storage).
If not provided, it defaults to {DEFAULT_MOUNT_PATH_PREFIX}/{id}.
cmd_before_mount: StringCommand to run before mounting (e.g. /bin/true)
auth_type: AuthTypeAuthentication method.
Most of the potential values match SSH’s PreferredAuthentications list, but some are special values that we recognize & handle here.
ssh_key: StringPath to an SSH private key (e.g. /home/user/.ssh/id_ed25519) for authentication types (like AuthType::PublicKey) that use a key.
Implementations§
Source§impl FilesystemMountDefinition
impl FilesystemMountDefinition
pub fn from_json_string(contents: &str) -> Result<Self, Error>
pub fn to_json_string(&self) -> Result<String>
Sourcepub fn local_mount_path(&self) -> String
pub fn local_mount_path(&self) -> String
Returns the local mount path for this definition.
If mount_dest_path is not None for this definition, it will be used.
Otherwise, the default mount path (DEFAULT_MOUNT_PATH_PREFIX) will be used (e.g. /mnt/sshfs/{id}).
Sourcepub fn mount_commands(&self) -> Result<Vec<Command>, SftpManError>
pub fn mount_commands(&self) -> Result<Vec<Command>, SftpManError>
Returns a list of commands for mounting the filesystem definition.
Mounting is performed via sshfs and ssh commands.
Sourcepub fn umount_commands(&self) -> Result<Vec<Command>, SftpManError>
pub fn umount_commands(&self) -> Result<Vec<Command>, SftpManError>
Returns a list of commands for unmounting the filesystem definition.
Unmounting with this command may fail if the filesystem is busy and a fallback mechanism may be necessary
(killing the sshfs process responsible for the mount).
Sourcepub fn open_command(&self) -> Command
pub fn open_command(&self) -> Command
Returns a command that opens a file manager (via xdg-open) at the local mount path (see local_mount_path()).
Opening requires that the filesystem is already mounted.
Trait Implementations§
Source§impl Clone for FilesystemMountDefinition
impl Clone for FilesystemMountDefinition
Source§fn clone(&self) -> FilesystemMountDefinition
fn clone(&self) -> FilesystemMountDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more