Skip to main content

ClienteSsh

Struct ClienteSsh 

Source
pub struct ClienteSsh {
    pub sessao: Handle<ManipuladorCliente>,
    /* private fields */
}
Available on crate feature ssh-real only.
Expand description

Cliente SSH ativo com sessão autenticada.

Fields§

§sessao: Handle<ManipuladorCliente>

Sessão SSH autenticada para operações de baixo nível.

Implementations§

Source§

impl ClienteSsh

Source

pub async fn conectar(cfg: ConfiguracaoConexao) -> ResultadoSshCli<Self>

Conecta e autentica. Todo o fluxo (TCP + handshake + auth) respeita o timeout_ms da configuração.

§Erros
Source

pub async fn executar_comando( &mut self, comando: &str, max_chars: usize, ) -> ResultadoSshCli<SaidaExecucao>

Executa um comando shell remoto e captura stdout/stderr em paralelo.

Trunca cada stream em max_chars codepoints UTF-8. Respeita o timeout_ms da configuração para a execução inteira.

§Erros
Source

pub async fn upload( &mut self, local: &Path, remote: &Path, ) -> ResultadoSshCli<TransferenciaResultado>

Upload de arquivo local para remote via SCP.

§Erros
Source

pub async fn download( &mut self, remote: &Path, local: &Path, ) -> ResultadoSshCli<TransferenciaResultado>

Download de arquivo remote para local via SCP.

§Erros
Source

pub async fn desconectar(&self) -> ResultadoSshCli<()>

Encerra a sessão SSH de forma limpa.

§Erros

Propaga falha se disconnect retornar erro do transporte.

Source

pub async fn abrir_canal_tunel( &self, host_remoto: &str, porta_remota: u16, endereco_origem: &str, porta_origem: u16, ) -> ResultadoSshCli<Box<dyn CanalTunel>>

Abre canal direct-tcpip para forwarding SSH.

Trait Implementations§

Source§

impl ClienteSshTrait for ClienteSsh

Source§

fn conectar<'async_trait>( cfg: ConfiguracaoConexao, ) -> Pin<Box<dyn Future<Output = Result<Box<Self>, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait,

Conecta a um servidor SSH e autentica com as credenciais fornecidas.
Source§

fn executar_comando<'life0, 'life1, 'async_trait>( &'life0 mut self, cmd: &'life1 str, max_chars: usize, ) -> Pin<Box<dyn Future<Output = Result<SaidaExecucao, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Executa um comando shell remoto e retorna a saída capturada.
Source§

fn upload<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, local: &'life1 Path, remote: &'life2 Path, ) -> Pin<Box<dyn Future<Output = Result<TransferenciaResultado, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Faz upload de um arquivo local para o servidor remoto via SCP.
Source§

fn download<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, remote: &'life1 Path, local: &'life2 Path, ) -> Pin<Box<dyn Future<Output = Result<TransferenciaResultado, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Faz download de um arquivo remoto para o sistema local via SCP.
Source§

fn abrir_canal_tunel<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, host_remoto: &'life1 str, porta_remota: u16, endereco_origem: &'life2 str, porta_origem: u16, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn CanalTunel>, ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Abre um canal direct-tcpip para forwarding de tunnel.
Source§

fn desconectar<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ErroSshCli>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Encerra a conexão SSH de forma limpa.
Source§

impl Debug for ClienteSsh

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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, 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<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more