Compare commits

...

2 Commits

881
Cargo.lock generated

File diff suppressed because it is too large Load Diff

@ -28,9 +28,9 @@ codegen-units = 1
strip = true
[features]
default = ["libssh", "ssh2"]
libssh = ["distant-ssh2/libssh"]
ssh2 = ["distant-ssh2/ssh2"]
default = ["vendored-openssl"]
openssl = ["distant-ssh2/openssl"]
vendored-openssl = ["distant-ssh2/vendored-openssl"]
[dependencies]
anyhow = "1.0.71"
@ -65,7 +65,7 @@ winsplit = "0.1.0"
whoami = "1.4.0"
# Optional native SSH functionality
distant-ssh2 = { version = "=0.20.0", path = "distant-ssh2", default-features = false, features = ["serde"], optional = true }
distant-ssh2 = { version = "=0.20.0", path = "distant-ssh2", features = ["serde"], optional = true }
[target.'cfg(unix)'.dependencies]
fork = "0.1.21"

@ -45,7 +45,7 @@ See https://distant.dev/getting-started/installation/windows/ for more details.
```sh
# Start a manager in the background
distant manager listen &
distant manager listen --daemon
# SSH into a server, start distant, and connect to the distant server
distant launch ssh://example.com

@ -11,12 +11,12 @@ readme = "README.md"
license = "MIT OR Apache-2.0"
[features]
default = ["libssh", "ssh2"]
libssh = ["wezterm-ssh/libssh-rs", "wezterm-ssh/vendored-openssl-libssh-rs"]
ssh2 = ["wezterm-ssh/ssh2", "wezterm-ssh/vendored-openssl-ssh2"]
default = ["flate2"]
flate2 = ["russh/flate2"]
openssl = ["russh/openssl"]
vendored-openssl = ["russh/vendored-openssl"]
[dependencies]
async-compat = "0.2.1"
async-once-cell = "0.5.2"
async-trait = "0.1.68"
derive_more = { version = "0.99.17", default-features = false, features = ["display", "error"] }
@ -26,11 +26,11 @@ hex = "0.4.3"
log = "0.4.18"
rand = { version = "0.8.5", features = ["getrandom"] }
rpassword = "7.2.0"
russh = { version = "0.37.1", default-features = false }
russh-config = "0.7.0"
shell-words = "1.1.0"
smol = "1.3.0"
tokio = { version = "1.28.2", features = ["full"] }
typed-path = "0.3.2"
wezterm-ssh = { version = "0.4.0", default-features = false }
winsplit = "0.1.0"
# Optional serde support for data structures

@ -15,9 +15,6 @@ use distant_core::protocol::{
use distant_core::{DistantApi, DistantCtx};
use log::*;
use tokio::sync::{mpsc, RwLock};
use wezterm_ssh::{
FilePermissions, OpenFileType, OpenOptions, Session as WezSession, Utf8PathBuf, WriteMode,
};
use crate::process::{spawn_pty, spawn_simple, SpawnResult};
use crate::utils::{self, to_other_error};

@ -26,10 +26,6 @@ use distant_core::{DistantApiServerHandler, DistantClient, DistantSingleKeyCrede
use log::*;
use smol::channel::Receiver as SmolReceiver;
use tokio::sync::Mutex;
use wezterm_ssh::{
ChildKiller, Config as WezConfig, MasterPty, PtySize, Session as WezSession,
SessionEvent as WezSessionEvent,
};
mod api;
mod process;
@ -58,78 +54,6 @@ impl SshFamily {
}
}
/// Represents the backend to use for ssh operations
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
pub enum SshBackend {
/// Use libssh as backend
#[cfg(feature = "libssh")]
LibSsh,
/// Use ssh2 as backend
#[cfg(feature = "ssh2")]
Ssh2,
}
impl SshBackend {
pub const fn as_static_str(&self) -> &'static str {
match self {
#[cfg(feature = "libssh")]
Self::LibSsh => "libssh",
#[cfg(feature = "ssh2")]
Self::Ssh2 => "ssh2",
}
}
}
impl Default for SshBackend {
/// Defaults to ssh2 if enabled, otherwise uses libssh by default
///
/// NOTE: There are currently bugs in libssh that cause our implementation to hang related to
/// process stdout/stderr and maybe other logic.
fn default() -> Self {
#[cfg(feature = "ssh2")]
{
Self::Ssh2
}
#[cfg(not(feature = "ssh2"))]
{
Self::LibSsh
}
}
}
impl FromStr for SshBackend {
type Err = &'static str;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
#[cfg(feature = "ssh2")]
s if s.trim().eq_ignore_ascii_case("ssh2") => Ok(Self::Ssh2),
#[cfg(feature = "libssh")]
s if s.trim().eq_ignore_ascii_case("libssh") => Ok(Self::LibSsh),
_ => Err("SSH backend must be \"libssh\" or \"ssh2\""),
}
}
}
impl fmt::Display for SshBackend {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
#[cfg(feature = "libssh")]
Self::LibSsh => write!(f, "libssh"),
#[cfg(feature = "ssh2")]
Self::Ssh2 => write!(f, "ssh2"),
}
}
}
/// Represents a singular authentication prompt for a new ssh client
#[derive(Debug)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
@ -162,9 +86,6 @@ pub struct SshAuthEvent {
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct SshOpts {
/// Represents the backend to use for ssh operations
pub backend: SshBackend,
/// List of files from which the user's DSA, ECDSA, Ed25519, or RSA authentication identity
/// is read, defaulting to
///

Loading…
Cancel
Save