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SY3RZ5IVDFENMGZG6X755GGZ6B3VQC
Y67GNDVBCXX5V3SL3OAQCU3NX52OR34NXK7ARKHK7EQDGCLVTHTQC
let packet = self
.compress
.compress(
&self.write[(self.write_cursor + 4)..(self.write_cursor + 4 + len)],
&mut self.compress_buffer,
)?;
let packet = self.compress.compress(
&self.write[(self.write_cursor + 4)..(self.write_cursor + 4 + len)],
&mut self.compress_buffer,
)?;
/// The type of authentications, which can be a future ultimately
/// resolving to
type FutureAuth: Future<Output = Result<(Self, Auth), Self::Error>> + Send;
/// The type of units returned by some parts of this handler.
type FutureUnit: Future<Output = Result<(Self, Session), Self::Error>> + Send;
/// The type of future bools returned by some parts of this handler.
type FutureBool: Future<Output = Result<(Self, Session, bool), Self::Error>> + Send;
/// Convert an `Auth` to `Self::FutureAuth`. This is used to
/// produce the default handlers.
fn finished_auth(self, auth: Auth) -> Self::FutureAuth;
/// Convert a `bool` to `Self::FutureBool`. This is used to
/// produce the default handlers.
fn finished_bool(self, b: bool, session: Session) -> Self::FutureBool;
/// Produce a `Self::FutureUnit`. This is used to produce the
/// default handlers.
fn finished(self, session: Session) -> Self::FutureUnit;
fn auth_password(self, user: &str, password: &str) -> Self::FutureAuth {
self.finished_auth(Auth::Reject)
fn auth_password(
self,
user: &str,
password: &str,
) -> impl Future<Output = Result<(Self, Auth), Self::Error>> + Send {
async { Ok((self, Auth::Reject)) }
fn auth_publickey(self, user: &str, public_key: &key::PublicKey) -> Self::FutureAuth {
self.finished_auth(Auth::Reject)
fn auth_publickey(
self,
user: &str,
public_key: &key::PublicKey,
) -> impl Future<Output = Result<(Self, Auth), Self::Error>> + Send {
async { Ok((self, Auth::Reject)) }
fn channel_close(self, channel: ChannelId, session: Session) -> Self::FutureUnit {
self.finished(session)
fn channel_close(
self,
channel: ChannelId,
session: Session,
) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
async { Ok((self, session)) }
fn channel_eof(self, channel: ChannelId, session: Session) -> Self::FutureUnit {
self.finished(session)
fn channel_eof(
self,
channel: ChannelId,
session: Session,
) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
async { Ok((self, session)) }
fn channel_open_session(self, channel: ChannelId, session: Session) -> Self::FutureUnit {
self.finished(session)
fn channel_open_session(
self,
channel: ChannelId,
session: Session,
) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
async { Ok((self, session)) }
fn data(self, channel: ChannelId, data: &[u8], session: Session) -> Self::FutureUnit {
self.finished(session)
fn data(
self,
channel: ChannelId,
data: &[u8],
session: Session,
) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
async { Ok((self, session)) }
fn shell_request(self, channel: ChannelId, session: Session) -> Self::FutureUnit {
self.finished(session)
fn shell_request(
self,
channel: ChannelId,
session: Session,
) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
async { Ok((self, session)) }
fn exec_request(self, channel: ChannelId, data: &[u8], session: Session) -> Self::FutureUnit {
self.finished(session)
fn exec_request(
self,
channel: ChannelId,
data: &[u8],
session: Session,
) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
async { Ok((self, session)) }
fn signal(self, channel: ChannelId, signal_name: Sig, session: Session) -> Self::FutureUnit {
self.finished(session)
fn signal(
self,
channel: ChannelId,
signal_name: Sig,
session: Session,
) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
async { Ok((self, session)) }
fn tcpip_forward(self, address: &str, port: u32, session: Session) -> Self::FutureBool {
self.finished_bool(false, session)
fn tcpip_forward(
self,
address: &str,
port: u32,
session: Session,
) -> impl Future<Output = Result<(Self, Session, bool), Self::Error>> + Send {
async { Ok((self, session, false)) }
fn cancel_tcpip_forward(self, address: &str, port: u32, session: Session) -> Self::FutureBool {
self.finished_bool(false, session)
fn cancel_tcpip_forward(
self,
address: &str,
port: u32,
session: Session,
) -> impl Future<Output = Result<(Self, Session, bool), Self::Error>> + Send {
async { Ok((self, session, false)) }
//! type FutureAuth = futures::future::Ready<Result<(Self, server::Auth), anyhow::Error>>;
//! type FutureUnit = futures::future::Ready<Result<(Self, Session), anyhow::Error>>;
//! type FutureBool = futures::future::Ready<Result<(Self, Session, bool), anyhow::Error>>;
//! fn finished_auth(mut self, auth: Auth) -> Self::FutureAuth {
//! futures::future::ready(Ok((self, auth)))
//! }
//! fn finished_bool(self, b: bool, s: Session) -> Self::FutureBool {
//! futures::future::ready(Ok((self, s, b)))
//! }
//! fn finished(self, s: Session) -> Self::FutureUnit {
//! futures::future::ready(Ok((self, s)))
//! }
//! fn channel_open_session(self, channel: ChannelId, session: Session) -> Self::FutureUnit {
//! fn channel_open_session(self, channel: ChannelId, session: Session) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
//! fn auth_publickey(self, _: &str, _: &key::PublicKey) -> Self::FutureAuth {
//! self.finished_auth(server::Auth::Accept)
//! fn auth_publickey(self, _: &str, _: &key::PublicKey) -> impl Future<Output = Result<(Self, Auth), Self::Error>> + Send {
//! async { Ok((self, server::Auth::Accept)) }
//! fn finished_bool(self, b: bool) -> Self::FutureBool {
//! futures::future::ready(Ok((self, b)))
//! }
//! fn finished(self, session: client::Session) -> Self::FutureUnit {
//! futures::future::ready(Ok((self, session)))
//! }
//! fn check_server_key(self, server_public_key: &key::PublicKey) -> Self::FutureBool {
//! fn check_server_key(self, server_public_key: &key::PublicKey) -> impl Future<Output = Result<(Self, bool), Self::Error>> + Send {
//! fn channel_open_confirmation(self, channel: ChannelId, max_packet_size: u32, window_size: u32, session: client::Session) -> Self::FutureUnit {
//!
//! fn channel_open_confirmation(self, channel: ChannelId, max_packet_size: u32, window_size: u32, session: client::Session) -> impl Future<Output = Result<(Self, client::Session), Self::Error>> + Send {
//! fn data(self, channel: ChannelId, data: &[u8], session: client::Session) -> Self::FutureUnit {
//!
//! fn data(self, channel: ChannelId, data: &[u8], session: client::Session) -> impl Future<Output = Result<(Self, client::Session), Self::Error>> + Send {
type FutureAuth = futures::future::Ready<Result<(Self, server::Auth), Self::Error>>;
type FutureUnit = futures::future::Ready<Result<(Self, Session), Self::Error>>;
type FutureBool = futures::future::Ready<Result<(Self, Session, bool), Self::Error>>;
fn finished_auth(self, auth: Auth) -> Self::FutureAuth {
futures::future::ready(Ok((self, auth)))
}
fn finished_bool(self, b: bool, s: Session) -> Self::FutureBool {
futures::future::ready(Ok((self, s, b)))
}
fn finished(self, s: Session) -> Self::FutureUnit {
futures::future::ready(Ok((self, s)))
}
fn channel_open_session(self, channel: ChannelId, session: Session) -> Self::FutureUnit {
fn channel_open_session(
self,
channel: ChannelId,
session: Session,
) -> impl Future<Output = Result<(Self, Session), Error>> + Send {
type FutureUnit = futures::future::Ready<Result<(Self, client::Session), Self::Error>>;
type FutureBool = futures::future::Ready<Result<(Self, bool), Self::Error>>;
fn finished_bool(self, b: bool) -> Self::FutureBool {
futures::future::ready(Ok((self, b)))
}
fn finished(self, session: client::Session) -> Self::FutureUnit {
futures::future::ready(Ok((self, session)))
}
/// A future ultimately resolving into a boolean, which can be
/// returned by some parts of this handler.
type FutureBool: Future<Output = Result<(Self, bool), Self::Error>> + Send;
/// A future ultimately resolving into unit, which can be
/// returned by some parts of this handler.
type FutureUnit: Future<Output = Result<(Self, Session), Self::Error>> + Send;
/// Convert a `bool` to `Self::FutureBool`. This is used to
/// produce the default handlers.
fn finished_bool(self, b: bool) -> Self::FutureBool;
fn auth_banner(self, banner: &str, session: Session) -> Self::FutureUnit {
self.finished(session)
fn auth_banner(
self,
banner: &str,
session: Session,
) -> impl Future<Output = Result<(Self, Session), Self::Error>> + Send {
async { Ok((self, session)) }
fn check_server_key(self, server_public_key: &key::PublicKey) -> Self::FutureBool {
self.finished_bool(false)
fn check_server_key(
self,
server_public_key: &key::PublicKey,
) -> impl Future<Output = Result<(Self, bool), Self::Error>> + Send {
async { Ok((self, false)) }
type FutureUnit = futures::future::Ready<Result<(Self, client::Session), Self::Error>>;
type FutureBool = futures::future::Ready<Result<(Self, bool), Self::Error>>;
fn finished_bool(self, b: bool) -> Self::FutureBool {
futures::future::ready(Ok((self, b)))
}
fn finished(self, session: client::Session) -> Self::FutureUnit {
futures::future::ready(Ok((self, session)))
}
fn check_server_key(self, _server_public_key: &key::PublicKey) -> Self::FutureBool {
self.finished_bool(true)
fn check_server_key(
self,
_server_public_key: &key::PublicKey,
) -> impl Future<Output = Result<(Self, bool), Self::Error>> + Send {
async { Ok((self, true)) }
type FutureUnit = futures::future::Ready<Result<(Self, client::Session), Self::Error>>;
type FutureBool = futures::future::Ready<Result<(Self, bool), Self::Error>>;
fn finished_bool(self, b: bool) -> Self::FutureBool {
futures::future::ready(Ok((self, b)))
}
fn finished(self, session: client::Session) -> Self::FutureUnit {
futures::future::ready(Ok((self, session)))
}
fn check_server_key(self, server_public_key: &key::PublicKey) -> Self::FutureBool {
fn check_server_key(
self,
server_public_key: &key::PublicKey,
) -> impl Future<Output = Result<(Self, bool), Self::Error>> + Send {