Trait thrussh::server::Handler [−][src]
pub trait Handler: Sized { type Error: From<Error> + Send; type FutureAuth: Future<Output = Result<(Self, Auth), Self::Error>> + Send; type FutureUnit: Future<Output = Result<(Self, Session), Self::Error>> + Send; type FutureBool: Future<Output = Result<(Self, Session, bool), Self::Error>> + Send;}Show methods
fn finished_auth(self, auth: Auth) -> Self::FutureAuth; fn finished_bool(self, b: bool, session: Session) -> Self::FutureBool; fn finished(self, session: Session) -> Self::FutureUnit; fn auth_none(self, user: &str) -> Self::FutureAuth { ... } fn auth_password(self, user: &str, password: &str) -> Self::FutureAuth { ... } fn auth_publickey(
self,
user: &str,
public_key: &PublicKey
) -> Self::FutureAuth { ... } fn auth_keyboard_interactive(
self,
user: &str,
submethods: &str,
response: Option<Response<'_>>
) -> Self::FutureAuth { ... } fn channel_close(
self,
channel: ChannelId,
session: Session
) -> Self::FutureUnit { ... } fn channel_eof(
self,
channel: ChannelId,
session: Session
) -> Self::FutureUnit { ... } fn channel_open_session(
self,
channel: ChannelId,
session: Session
) -> Self::FutureUnit { ... } fn channel_open_x11(
self,
channel: ChannelId,
originator_address: &str,
originator_port: u32,
session: Session
) -> Self::FutureUnit { ... } fn channel_open_direct_tcpip(
self,
channel: ChannelId,
host_to_connect: &str,
port_to_connect: u32,
originator_address: &str,
originator_port: u32,
session: Session
) -> Self::FutureUnit { ... } fn data(
self,
channel: ChannelId,
data: &[u8],
session: Session
) -> Self::FutureUnit { ... } fn extended_data(
self,
channel: ChannelId,
code: u32,
data: &[u8],
session: Session
) -> Self::FutureUnit { ... } fn window_adjusted(
self,
channel: ChannelId,
new_window_size: usize,
session: Session
) -> Self::FutureUnit { ... } fn adjust_window(&mut self, channel: ChannelId, current: u32) -> u32 { ... } fn pty_request(
self,
channel: ChannelId,
term: &str,
col_width: u32,
row_height: u32,
pix_width: u32,
pix_height: u32,
modes: &[(Pty, u32)],
session: Session
) -> Self::FutureUnit { ... } fn x11_request(
self,
channel: ChannelId,
single_connection: bool,
x11_auth_protocol: &str,
x11_auth_cookie: &str,
x11_screen_number: u32,
session: Session
) -> Self::FutureUnit { ... } fn env_request(
self,
channel: ChannelId,
variable_name: &str,
variable_value: &str,
session: Session
) -> Self::FutureUnit { ... } fn shell_request(
self,
channel: ChannelId,
session: Session
) -> Self::FutureUnit { ... } fn exec_request(
self,
channel: ChannelId,
data: &[u8],
session: Session
) -> Self::FutureUnit { ... } fn subsystem_request(
self,
channel: ChannelId,
name: &str,
session: Session
) -> Self::FutureUnit { ... } fn window_change_request(
self,
channel: ChannelId,
col_width: u32,
row_height: u32,
pix_width: u32,
pix_height: u32,
session: Session
) -> Self::FutureUnit { ... } fn signal(
self,
channel: ChannelId,
signal_name: Sig,
session: Session
) -> Self::FutureUnit { ... } fn tcpip_forward(
self,
address: &str,
port: u32,
session: Session
) -> Self::FutureBool { ... } fn cancel_tcpip_forward(
self,
address: &str,
port: u32,
session: Session
) -> Self::FutureBool { ... }
Expand description
Server handler. Each client will have their own handler.
Associated Types
The type of authentications, which can be a future ultimately resolving to
The type of units returned by some parts of this handler.
Required methods
fn finished_auth(self, auth: Auth) -> Self::FutureAuth
fn finished_auth(self, auth: Auth) -> Self::FutureAuth
Convert an Auth
to Self::FutureAuth
. This is used to
produce the default handlers.
fn finished_bool(self, b: bool, session: Session) -> Self::FutureBool
fn finished_bool(self, b: bool, session: Session) -> Self::FutureBool
Convert a bool
to Self::FutureBool
. This is used to
produce the default handlers.
fn finished(self, session: Session) -> Self::FutureUnit
fn finished(self, session: Session) -> Self::FutureUnit
Produce a Self::FutureUnit
. This is used to produce the
default handlers.
Provided methods
fn auth_none(self, user: &str) -> Self::FutureAuth
fn auth_none(self, user: &str) -> Self::FutureAuth
Check authentication using the “none” method. Thrussh makes
sure rejection happens in time config.auth_rejection_time
,
except if this method takes more than that.
fn auth_password(self, user: &str, password: &str) -> Self::FutureAuth
fn auth_password(self, user: &str, password: &str) -> Self::FutureAuth
Check authentication using the “password” method. Thrussh
makes sure rejection happens in time
config.auth_rejection_time
, except if this method takes more
than that.
fn auth_publickey(self, user: &str, public_key: &PublicKey) -> Self::FutureAuth
fn auth_publickey(self, user: &str, public_key: &PublicKey) -> Self::FutureAuth
Check authentication using the “publickey” method. This method
should just check whether the public key matches the
authorized ones. Thrussh then checks the signature. If the key
is unknown, or the signature is invalid, Thrussh guarantees
that rejection happens in constant time
config.auth_rejection_time
, except if this method takes more
time than that.
fn auth_keyboard_interactive(
self,
user: &str,
submethods: &str,
response: Option<Response<'_>>
) -> Self::FutureAuth
fn auth_keyboard_interactive(
self,
user: &str,
submethods: &str,
response: Option<Response<'_>>
) -> Self::FutureAuth
Check authentication using the “keyboard-interactive”
method. Thrussh makes sure rejection happens in time
config.auth_rejection_time
, except if this method takes more
than that.
fn channel_close(self, channel: ChannelId, session: Session) -> Self::FutureUnit
fn channel_close(self, channel: ChannelId, session: Session) -> Self::FutureUnit
Called when the client closes a channel.
fn channel_eof(self, channel: ChannelId, session: Session) -> Self::FutureUnit
fn channel_eof(self, channel: ChannelId, session: Session) -> Self::FutureUnit
Called when the client sends EOF to a channel.
fn channel_open_session(
self,
channel: ChannelId,
session: Session
) -> Self::FutureUnit
fn channel_open_session(
self,
channel: ChannelId,
session: Session
) -> Self::FutureUnit
Called when a new session channel is created.
fn channel_open_x11(
self,
channel: ChannelId,
originator_address: &str,
originator_port: u32,
session: Session
) -> Self::FutureUnit
fn channel_open_x11(
self,
channel: ChannelId,
originator_address: &str,
originator_port: u32,
session: Session
) -> Self::FutureUnit
Called when a new X11 channel is created.
fn channel_open_direct_tcpip(
self,
channel: ChannelId,
host_to_connect: &str,
port_to_connect: u32,
originator_address: &str,
originator_port: u32,
session: Session
) -> Self::FutureUnit
fn channel_open_direct_tcpip(
self,
channel: ChannelId,
host_to_connect: &str,
port_to_connect: u32,
originator_address: &str,
originator_port: u32,
session: Session
) -> Self::FutureUnit
Called when a new channel is created.
Called when a data packet is received. A response can be
written to the response
argument.
fn extended_data(
self,
channel: ChannelId,
code: u32,
data: &[u8],
session: Session
) -> Self::FutureUnit
fn extended_data(
self,
channel: ChannelId,
code: u32,
data: &[u8],
session: Session
) -> Self::FutureUnit
Called when an extended data packet is received. Code 1 means that this packet comes from stderr, other codes are not defined (see RFC4254).
fn window_adjusted(
self,
channel: ChannelId,
new_window_size: usize,
session: Session
) -> Self::FutureUnit
fn window_adjusted(
self,
channel: ChannelId,
new_window_size: usize,
session: Session
) -> Self::FutureUnit
Called when the network window is adjusted, meaning that we can send more bytes.
fn adjust_window(&mut self, channel: ChannelId, current: u32) -> u32
fn adjust_window(&mut self, channel: ChannelId, current: u32) -> u32
Called when this server adjusts the network window. Return the next target window.
The client requests a pseudo-terminal with the given specifications.
fn x11_request(
self,
channel: ChannelId,
single_connection: bool,
x11_auth_protocol: &str,
x11_auth_cookie: &str,
x11_screen_number: u32,
session: Session
) -> Self::FutureUnit
fn x11_request(
self,
channel: ChannelId,
single_connection: bool,
x11_auth_protocol: &str,
x11_auth_cookie: &str,
x11_screen_number: u32,
session: Session
) -> Self::FutureUnit
The client requests an X11 connection.
fn env_request(
self,
channel: ChannelId,
variable_name: &str,
variable_value: &str,
session: Session
) -> Self::FutureUnit
fn env_request(
self,
channel: ChannelId,
variable_name: &str,
variable_value: &str,
session: Session
) -> Self::FutureUnit
The client wants to set the given environment variable. Check these carefully, as it is dangerous to allow any variable environment to be set.
fn shell_request(self, channel: ChannelId, session: Session) -> Self::FutureUnit
fn shell_request(self, channel: ChannelId, session: Session) -> Self::FutureUnit
The client requests a shell.
fn exec_request(
self,
channel: ChannelId,
data: &[u8],
session: Session
) -> Self::FutureUnit
fn exec_request(
self,
channel: ChannelId,
data: &[u8],
session: Session
) -> Self::FutureUnit
The client sends a command to execute, to be passed to a shell. Make sure to check the command before doing so.
fn subsystem_request(
self,
channel: ChannelId,
name: &str,
session: Session
) -> Self::FutureUnit
fn subsystem_request(
self,
channel: ChannelId,
name: &str,
session: Session
) -> Self::FutureUnit
The client asks to start the subsystem with the given name (such as sftp).
fn window_change_request(
self,
channel: ChannelId,
col_width: u32,
row_height: u32,
pix_width: u32,
pix_height: u32,
session: Session
) -> Self::FutureUnit
fn window_change_request(
self,
channel: ChannelId,
col_width: u32,
row_height: u32,
pix_width: u32,
pix_height: u32,
session: Session
) -> Self::FutureUnit
The client’s pseudo-terminal window size has changed.
The client is sending a signal (usually to pass to the currently running process).
fn tcpip_forward(
self,
address: &str,
port: u32,
session: Session
) -> Self::FutureBool
fn tcpip_forward(
self,
address: &str,
port: u32,
session: Session
) -> Self::FutureBool
Used for reverse-forwarding ports, see RFC4254.
fn cancel_tcpip_forward(
self,
address: &str,
port: u32,
session: Session
) -> Self::FutureBool
fn cancel_tcpip_forward(
self,
address: &str,
port: u32,
session: Session
) -> Self::FutureBool
Used to stop the reverse-forwarding of a port, see RFC4254.