Server

Struct Server 

Source
pub struct Server<B: Backend> {
    pub clients: Arc<Mutex<HashMap<(usize, ChannelId), Handle>>>,
    pub id: usize,
    /* private fields */
}

Fields§

§clients: Arc<Mutex<HashMap<(usize, ChannelId), Handle>>>§id: usize

Implementations§

Source§

impl<B: Backend> Server<B>

Source

pub fn new(backend: B, id: usize) -> Self

Trait Implementations§

Source§

impl<B: Clone + Backend> Clone for Server<B>

Source§

fn clone(&self) -> Server<B>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<B: Backend> Handler for Server<B>

Source§

type Error = Error

Source§

type FutureAuth = Ready<Result<(Server<B>, Auth), Error>>

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

type FutureUnit = Ready<Result<(Server<B>, Session), Error>>

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

type FutureBool = Ready<Result<(Server<B>, Session, bool), Error>>

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

fn finished_auth(self, auth: Auth) -> Self::FutureAuth

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

fn finished_bool(self, result: bool, session: Session) -> Self::FutureBool

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

fn finished(self, session: Session) -> Self::FutureUnit

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

fn channel_open_session( self, channel: ChannelId, session: Session, ) -> Self::FutureUnit

Called when a new session channel is created.
Source§

fn auth_publickey(self, _: &str, _: &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.
Source§

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.
Source§

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

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

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).
Source§

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.
Source§

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.
Source§

fn channel_close(self, channel: ChannelId, session: Session) -> Self::FutureUnit

Called when the client closes a channel.
Source§

fn channel_eof(self, channel: ChannelId, session: Session) -> Self::FutureUnit

Called when the client sends EOF to a channel.
Source§

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.
Source§

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.
Source§

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).
Source§

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.
Source§

fn adjust_window(&mut self, channel: ChannelId, current: u32) -> u32

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

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

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

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.
Source§

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.
Source§

fn shell_request(self, channel: ChannelId, session: Session) -> Self::FutureUnit

The client requests a shell.
Source§

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.
Source§

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.
Source§

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

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

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

Used for reverse-forwarding ports, see RFC4254.
Source§

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

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

impl<B: Backend> Server for Server<B>

Source§

type Handler = Server<B>

The type of handlers.
Source§

fn new(&mut self, _: Option<SocketAddr>) -> Self

Called when a new client connects.

Auto Trait Implementations§

§

impl<B> Freeze for Server<B>
where B: Freeze,

§

impl<B> !RefUnwindSafe for Server<B>

§

impl<B> Send for Server<B>

§

impl<B> Sync for Server<B>

§

impl<B> Unpin for Server<B>
where B: Unpin,

§

impl<B> !UnwindSafe for Server<B>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V