Skip to main content

Module remote

Module remote 

Source
Expand description

Everything that touches the remote host: one multiplexed OpenSSH session, an SFTP channel on top of it, and the operations the tools are built from.

Design rules:

  • Authentication is OpenSSH’s job. FarHand starts ssh <host> and lets the user’s own config supply keys, agents, jump hosts and ports.
  • Command text is never shell-escaped by hand. It is base64-encoded and decoded on the remote, so quoting cannot go wrong.
  • The local environment is never forwarded.
  • Every command runs under a remote timeout with a local watchdog behind it.
  • Directory creation and tree walking go through SFTP, not the shell, so they behave the same on every platform.

Two platforms: POSIX (a sh, timeout(1) and base64(1); the configured shell runs the script) and Windows with OpenSSH Server, where the script runs in PowerShell. See Platform.

Structs§

Address
The remote as reachable from the local machine.
ExecOutput
Remote

Enums§

Platform
What the remote runs, detected from the SFTP root on connect.

Functions§

normalize
Collapse . and .. segments without touching the filesystem.
normalize_windows
Windows form with backslashes and a drive: accepts C:/a/../b, /C:/a/b (SFTP form) and C:\a\b; UNC paths keep their \\ prefix.
ps_quote
Quote for PowerShell as a single-quoted literal.