pub struct ClientHandler { /* private fields */ }ssh-real only.Expand description
Real SSH client backed by russh (default feature ssh-real).
russh handler with TOFU known_hosts (or test-only always-trust when path is absent).
Implementations§
Source§impl ClientHandler
impl ClientHandler
Sourcepub fn new(
cfg: &ConnectionConfig,
outcome: Arc<Mutex<Option<SshCliError>>>,
forwarded: Sender<Channel<Msg>>,
) -> Self
pub fn new( cfg: &ConnectionConfig, outcome: Arc<Mutex<Option<SshCliError>>>, forwarded: Sender<Channel<Msg>>, ) -> Self
Build a handler from connection config, outcome slot and inbound-channel sink.
Trait Implementations§
Source§impl Handler for ClientHandler
impl Handler for ClientHandler
Source§async fn server_channel_open_forwarded_tcpip(
&mut self,
channel: Channel<Msg>,
connected_address: &str,
connected_port: u32,
originator_address: &str,
originator_port: u32,
reply: ChannelOpenHandle,
_session: &mut Session,
) -> Result<(), Self::Error>
async fn server_channel_open_forwarded_tcpip( &mut self, channel: Channel<Msg>, connected_address: &str, connected_port: u32, originator_address: &str, originator_port: u32, reply: ChannelOpenHandle, _session: &mut Session, ) -> Result<(), Self::Error>
Accepts a forwarded-tcpip channel opened by the server (G-TUN-R01).
Only channels that fit in the bounded queue are accepted. A full queue means nobody is draining the reverse forward, so accepting would buffer indefinitely on the peer’s schedule; rejecting applies backpressure over the wire instead.
The default russh implementation accepts unconditionally and drops the channel, which for a client that never requested a forward means silently letting a server open channels into the process.
Source§async fn server_channel_open_forwarded_streamlocal(
&mut self,
_channel: Channel<Msg>,
socket_path: &str,
reply: ChannelOpenHandle,
_session: &mut Session,
) -> Result<(), Self::Error>
async fn server_channel_open_forwarded_streamlocal( &mut self, _channel: Channel<Msg>, socket_path: &str, reply: ChannelOpenHandle, _session: &mut Session, ) -> Result<(), Self::Error>
Rejects forwarded-streamlocal channels.
This CLI only ever requests outbound streamlocal channels
(--remote-socket), never a remote Unix-socket listener, so an inbound one
was not asked for. Accepting and dropping it — the russh default — would make
the refusal invisible to both sides.
type Error = Error
Source§async fn check_server_key(
&mut self,
server_key: &PublicKey,
) -> Result<bool, Self::Error>
async fn check_server_key( &mut self, server_key: &PublicKey, ) -> Result<bool, Self::Error>
Source§fn kex_done(
&mut self,
shared_secret: Option<&[u8]>,
names: &Names,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn kex_done( &mut self, shared_secret: Option<&[u8]>, names: &Names, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn channel_open_confirmation(
&mut self,
id: ChannelId,
max_packet_size: u32,
window_size: u32,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn channel_open_confirmation( &mut self, id: ChannelId, max_packet_size: u32, window_size: u32, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn channel_success(
&mut self,
channel: ChannelId,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn channel_success( &mut self, channel: ChannelId, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn channel_failure(
&mut self,
channel: ChannelId,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn channel_failure( &mut self, channel: ChannelId, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn channel_close(
&mut self,
channel: ChannelId,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn channel_close( &mut self, channel: ChannelId, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn channel_eof(
&mut self,
channel: ChannelId,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn channel_eof( &mut self, channel: ChannelId, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn channel_open_failure(
&mut self,
channel: ChannelId,
reason: ChannelOpenFailure,
description: &str,
language: &str,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn channel_open_failure( &mut self, channel: ChannelId, reason: ChannelOpenFailure, description: &str, language: &str, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn server_channel_open_agent_forward(
&mut self,
channel: Channel<Msg>,
reply: ChannelOpenHandleInner<Msg>,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn server_channel_open_agent_forward( &mut self, channel: Channel<Msg>, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn should_accept_unknown_server_channel(
&mut self,
id: ChannelId,
channel_type: &str,
) -> impl Future<Output = bool> + Send
fn should_accept_unknown_server_channel( &mut self, id: ChannelId, channel_type: &str, ) -> impl Future<Output = bool> + Send
true,
if the channel of unknown type should be accepted. In this case,
Handler::server_channel_open_unknown will be called soon after. If it returns false,
the channel will not be created and a rejection message will be sent to the server.Source§fn server_channel_open_unknown(
&mut self,
channel: Channel<Msg>,
reply: ChannelOpenHandleInner<Msg>,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn server_channel_open_unknown( &mut self, channel: Channel<Msg>, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
should_accept_unknown_server_channel
returned true). Read moreSource§fn server_channel_open_session(
&mut self,
channel: Channel<Msg>,
reply: ChannelOpenHandleInner<Msg>,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn server_channel_open_session( &mut self, channel: Channel<Msg>, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn server_channel_open_direct_tcpip(
&mut self,
channel: Channel<Msg>,
host_to_connect: &str,
port_to_connect: u32,
originator_address: &str,
originator_port: u32,
reply: ChannelOpenHandleInner<Msg>,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn server_channel_open_direct_tcpip( &mut self, channel: Channel<Msg>, host_to_connect: &str, port_to_connect: u32, originator_address: &str, originator_port: u32, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn server_channel_open_direct_streamlocal(
&mut self,
channel: Channel<Msg>,
socket_path: &str,
reply: ChannelOpenHandleInner<Msg>,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn server_channel_open_direct_streamlocal( &mut self, channel: Channel<Msg>, socket_path: &str, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn server_channel_open_x11(
&mut self,
channel: Channel<Msg>,
originator_address: &str,
originator_port: u32,
reply: ChannelOpenHandleInner<Msg>,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn server_channel_open_x11( &mut self, channel: Channel<Msg>, originator_address: &str, originator_port: u32, reply: ChannelOpenHandleInner<Msg>, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn data(
&mut self,
channel: ChannelId,
data: &[u8],
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn data( &mut self, channel: ChannelId, data: &[u8], session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
extended_code
parameter is a stream identifier, None is usually the
standard output, and Some(1) is the standard error. See
RFC4254.Source§fn extended_data(
&mut self,
channel: ChannelId,
ext: u32,
data: &[u8],
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn extended_data( &mut self, channel: ChannelId, ext: u32, data: &[u8], session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
extended_code
parameter is a stream identifier, None is usually the
standard output, and Some(1) is the standard error. See
RFC4254.Source§fn xon_xoff(
&mut self,
channel: ChannelId,
client_can_do: bool,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn xon_xoff( &mut self, channel: ChannelId, client_can_do: bool, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn exit_status(
&mut self,
channel: ChannelId,
exit_status: u32,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn exit_status( &mut self, channel: ChannelId, exit_status: u32, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn exit_signal(
&mut self,
channel: ChannelId,
signal_name: Sig,
core_dumped: bool,
error_message: &str,
lang_tag: &str,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn exit_signal( &mut self, channel: ChannelId, signal_name: Sig, core_dumped: bool, error_message: &str, lang_tag: &str, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn window_adjusted(
&mut self,
channel: ChannelId,
new_size: u32,
session: &mut Session,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn window_adjusted( &mut self, channel: ChannelId, new_size: u32, session: &mut Session, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Session::data before, and it returned less than the
full amount of data.