[][src]Trait thrussh::server::Handler

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;
    pub fn finished_auth(self, auth: Auth) -> Self::FutureAuth;
pub fn finished_bool(self, b: bool, session: Session) -> Self::FutureBool;
pub fn finished(self, session: Session) -> Self::FutureUnit; pub fn auth_none(self, user: &str) -> Self::FutureAuth { ... }
pub fn auth_password(self, user: &str, password: &str) -> Self::FutureAuth { ... }
pub fn auth_publickey(
        self,
        user: &str,
        public_key: &PublicKey
    ) -> Self::FutureAuth { ... }
pub fn auth_keyboard_interactive(
        self,
        user: &str,
        submethods: &str,
        response: Option<Response<'_>>
    ) -> Self::FutureAuth { ... }
pub fn channel_close(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn channel_eof(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn channel_open_session(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn channel_open_x11(
        self,
        channel: ChannelId,
        originator_address: &str,
        originator_port: u32,
        session: Session
    ) -> Self::FutureUnit { ... }
pub 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 { ... }
pub fn data(
        self,
        channel: ChannelId,
        data: &[u8],
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn extended_data(
        self,
        channel: ChannelId,
        code: u32,
        data: &[u8],
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn window_adjusted(
        self,
        channel: ChannelId,
        new_window_size: usize,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn adjust_window(&mut self, channel: ChannelId, current: u32) -> u32 { ... }
pub 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 { ... }
pub 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 { ... }
pub fn env_request(
        self,
        channel: ChannelId,
        variable_name: &str,
        variable_value: &str,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn shell_request(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn exec_request(
        self,
        channel: ChannelId,
        data: &[u8],
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn subsystem_request(
        self,
        channel: ChannelId,
        name: &str,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn window_change_request(
        self,
        channel: ChannelId,
        col_width: u32,
        row_height: u32,
        pix_width: u32,
        pix_height: u32,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn signal(
        self,
        channel: ChannelId,
        signal_name: Sig,
        session: Session
    ) -> Self::FutureUnit { ... }
pub fn tcpip_forward(
        self,
        address: &str,
        port: u32,
        session: Session
    ) -> Self::FutureBool { ... }
pub fn cancel_tcpip_forward(
        self,
        address: &str,
        port: u32,
        session: Session
    ) -> Self::FutureBool { ... } }

Server handler. Each client will have their own handler.

Associated Types

type Error: From<Error> + Send[src]

type FutureAuth: Future<Output = Result<(Self, Auth), Self::Error>> + Send[src]

The type of authentications, which can be a future ultimately resolving to

type FutureUnit: Future<Output = Result<(Self, Session), Self::Error>> + Send[src]

The type of units returned by some parts of this handler.

type FutureBool: Future<Output = Result<(Self, Session, bool), Self::Error>> + Send[src]

The type of future bools returned by some parts of this handler.

Loading content...

Required methods

pub fn finished_auth(self, auth: Auth) -> Self::FutureAuth[src]

Convert an Auth to Self::FutureAuth. This is used to produce the default handlers.

pub fn finished_bool(self, b: bool, session: Session) -> Self::FutureBool[src]

Convert a bool to Self::FutureBool. This is used to produce the default handlers.

pub fn finished(self, session: Session) -> Self::FutureUnit[src]

Produce a Self::FutureUnit. This is used to produce the default handlers.

Loading content...

Provided methods

pub fn auth_none(self, user: &str) -> Self::FutureAuth[src]

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.

pub fn auth_password(self, user: &str, password: &str) -> Self::FutureAuth[src]

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.

pub fn auth_publickey(
    self,
    user: &str,
    public_key: &PublicKey
) -> Self::FutureAuth
[src]

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.

pub fn auth_keyboard_interactive(
    self,
    user: &str,
    submethods: &str,
    response: Option<Response<'_>>
) -> Self::FutureAuth
[src]

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.

pub fn channel_close(
    self,
    channel: ChannelId,
    session: Session
) -> Self::FutureUnit
[src]

Called when the client closes a channel.

pub fn channel_eof(
    self,
    channel: ChannelId,
    session: Session
) -> Self::FutureUnit
[src]

Called when the client sends EOF to a channel.

pub fn channel_open_session(
    self,
    channel: ChannelId,
    session: Session
) -> Self::FutureUnit
[src]

Called when a new session channel is created.

pub fn channel_open_x11(
    self,
    channel: ChannelId,
    originator_address: &str,
    originator_port: u32,
    session: Session
) -> Self::FutureUnit
[src]

Called when a new X11 channel is created.

pub 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
[src]

Called when a new channel is created.

pub fn data(
    self,
    channel: ChannelId,
    data: &[u8],
    session: Session
) -> Self::FutureUnit
[src]

Called when a data packet is received. A response can be written to the response argument.

pub fn extended_data(
    self,
    channel: ChannelId,
    code: u32,
    data: &[u8],
    session: Session
) -> Self::FutureUnit
[src]

Called when an extended data packet is received. Code 1 means that this packet comes from stderr, other codes are not defined (see RFC4254).

pub fn window_adjusted(
    self,
    channel: ChannelId,
    new_window_size: usize,
    session: Session
) -> Self::FutureUnit
[src]

Called when the network window is adjusted, meaning that we can send more bytes.

pub fn adjust_window(&mut self, channel: ChannelId, current: u32) -> u32[src]

Called when this server adjusts the network window. Return the next target window.

pub 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
[src]

The client requests a pseudo-terminal with the given specifications.

pub 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
[src]

The client requests an X11 connection.

pub fn env_request(
    self,
    channel: ChannelId,
    variable_name: &str,
    variable_value: &str,
    session: Session
) -> Self::FutureUnit
[src]

The client wants to set the given environment variable. Check these carefully, as it is dangerous to allow any variable environment to be set.

pub fn shell_request(
    self,
    channel: ChannelId,
    session: Session
) -> Self::FutureUnit
[src]

The client requests a shell.

pub fn exec_request(
    self,
    channel: ChannelId,
    data: &[u8],
    session: Session
) -> Self::FutureUnit
[src]

The client sends a command to execute, to be passed to a shell. Make sure to check the command before doing so.

pub fn subsystem_request(
    self,
    channel: ChannelId,
    name: &str,
    session: Session
) -> Self::FutureUnit
[src]

The client asks to start the subsystem with the given name (such as sftp).

pub fn window_change_request(
    self,
    channel: ChannelId,
    col_width: u32,
    row_height: u32,
    pix_width: u32,
    pix_height: u32,
    session: Session
) -> Self::FutureUnit
[src]

The client's pseudo-terminal window size has changed.

pub fn signal(
    self,
    channel: ChannelId,
    signal_name: Sig,
    session: Session
) -> Self::FutureUnit
[src]

The client is sending a signal (usually to pass to the currently running process).

pub fn tcpip_forward(
    self,
    address: &str,
    port: u32,
    session: Session
) -> Self::FutureBool
[src]

Used for reverse-forwarding ports, see RFC4254.

pub fn cancel_tcpip_forward(
    self,
    address: &str,
    port: u32,
    session: Session
) -> Self::FutureBool
[src]

Used to stop the reverse-forwarding of a port, see RFC4254.

Loading content...

Implementors

Loading content...