feat(sandokan-remote): B1.4 — RemoteEngine vía SSH socket-forward
Opción B: RemoteEngine orquesta en un host remoto tunelando el wire
del daemon sobre un canal SSH direct-streamlocal hacia el sandokan.sock
remoto. El protocolo es idéntico al de DaemonEngine (postcard
length-prefixed) — sólo cambia el transporte, así que read_frame/
write_frame se reusan tal cual.
- brahman-ssh-multiplex: + SshSession::forward_unix — abre un canal
direct-streamlocal y devuelve su ChannelStream (AsyncRead+AsyncWrite).
- sandokan-daemon: protocol ahora pub, exporta read_frame/write_frame.
- sandokan-remote: RemoteEngine { SshSession + remote_socket }.
connect() o with_session(); cada operación abre un canal nuevo
(multiplexado sobre la conexión maestra).
- sandokan umbrella re-exporta RemoteEngine.
Completa Fase B: sandokan tiene Local + Daemon + Remote + auto().
cargo check --workspace verde. RemoteEngine necesita un host remoto
con `sandokan daemon` para validación runtime (sin unit test).
Opción A (text-parse del CLI por compat) queda pendiente por decisión
del usuario.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -141,6 +141,24 @@ impl SshSession {
|
||||
Ok(Self { handle: Arc::new(handle) })
|
||||
}
|
||||
|
||||
/// Abre un canal `direct-streamlocal` hacia un Unix socket del host
|
||||
/// remoto y devuelve su stream bidireccional (`AsyncRead + AsyncWrite`).
|
||||
///
|
||||
/// Permite tunelar un protocolo arbitrario (p. ej. el wire postcard
|
||||
/// de `sandokan-daemon`) contra un socket remoto, reusando el código
|
||||
/// de cliente sin cambios — sólo cambia el transporte.
|
||||
pub async fn forward_unix(
|
||||
&self,
|
||||
remote_socket: &str,
|
||||
) -> Result<russh::ChannelStream<russh::client::Msg>, SshError> {
|
||||
let channel = self
|
||||
.handle
|
||||
.channel_open_direct_streamlocal(remote_socket)
|
||||
.await
|
||||
.map_err(|e| SshError::Channel(e.to_string()))?;
|
||||
Ok(channel.into_stream())
|
||||
}
|
||||
|
||||
/// Ejecuta `command` en un canal nuevo y junta su salida completa.
|
||||
/// Canales concurrentes se multiplexan sobre la misma conexión.
|
||||
pub async fn exec(&self, command: &str) -> Result<ExecOutput, SshError> {
|
||||
|
||||
Reference in New Issue
Block a user