diff --git a/src/cli/args.rs b/src/cli/args.rs index 1427472..8144fbb 100644 --- a/src/cli/args.rs +++ b/src/cli/args.rs @@ -41,7 +41,7 @@ pub(crate) struct CliArgs { /// intended for interactive use. #[arg( long, help_heading("Modes"), hide = true, - conflicts_with_all(["help_buffers", "quiet", "statistics", "timeout", "ipv4", "ipv6", "remote_debug", "profile"]) + conflicts_with_all(["help_buffers", "quiet", "statistics", "timeout", "ipv4", "ipv6", "remote_debug", "profile", "source", "destination", "ssh", "ssh_opt"]) )] pub server: bool, @@ -71,6 +71,21 @@ pub(crate) struct CliArgs { #[arg(short = '6', long, action, conflicts_with("ipv4"))] pub ipv6: bool, + /// Specifies the ssh client program to use + #[arg(long, default_value("ssh"))] + pub ssh: String, + + /// Specifies an additional option or argument to pass to the ssh client. + /// Note: you must repeat `-S` for each. + /// For example, to pass `-i /dev/null` to ssh, specify `-S -i -S /dev/null` + #[arg( + short = 'S', + action, + value_name("ssh-option"), + allow_hyphen_values(true) + )] + pub ssh_opt: Vec, + // CLIENT DEBUG ---------------------------- /// Enable detailed debug output #[arg(short, long, action, help_heading("Debug options"), display_order(100))] diff --git a/src/client/control.rs b/src/client/control.rs index e5e0e10..95e5ce7 100644 --- a/src/client/control.rs +++ b/src/client/control.rs @@ -26,6 +26,8 @@ pub struct Parameters { bbr: bool, iwind: Option, family: AddressFamily, + ssh_client: String, + ssh_opts: Vec, } impl TryFrom<&CliArgs> for Parameters { @@ -43,6 +45,8 @@ impl TryFrom<&CliArgs> for Parameters { bbr: args.bbr, iwind: args.initial_congestion_window, family: args.address_family(), + ssh_client: args.ssh.clone(), + ssh_opts: args.ssh_opt.clone(), }) } } @@ -93,13 +97,14 @@ impl ControlChannel { /// This is effectively a constructor. At present, it launches a subprocess. fn launch(args: &Parameters) -> Result { - let mut server = tokio::process::Command::new("ssh"); + let mut server = tokio::process::Command::new(&args.ssh_client); let _ = server.kill_on_drop(true); let _ = match args.family { AddressFamily::Any => &mut server, AddressFamily::IPv4 => server.arg("-4"), AddressFamily::IPv6 => server.arg("-6"), }; + let _ = server.args(&args.ssh_opts); let _ = server.args([ &args.remote_user_host, "qcp",