mirror of
https://github.com/ergosteur/ssh-protocol-handler-win.git
synced 2026-10-28 08:10:35 -04:00
Raw Win32 rewrite (windows-rs + a native dialog resource, no GUI framework) of SshHandler, aimed at eliminating .NET's ~150MB self-contained payload and CLR startup cost for what's just a click-triggered dialog + process launch. Release build cross-compiles to a ~250KB binary. Same behavior as the WinForms version: registry setup mode, target parsing/editing dialog, legacy-algorithm option, launches ssh.exe via ShellExecuteW. Verified functionally under Wine (registry-setup prompt and the connect dialog both render and round-trip correctly); real Windows cold-start numbers still need to be gathered on actual hardware. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GYCT2RpUjFfBfp6CD4rREw
41 lines
1.4 KiB
Markdown
41 lines
1.4 KiB
Markdown
# ssh-handler (Rust)
|
|
|
|
A from-scratch rewrite of `SshHandler` (the .NET/WinForms `ssh://` protocol
|
|
handler) in Rust, targeting raw Win32 (via `windows-rs`) instead of a managed
|
|
GUI framework. Same behavior, same registry keys, same dialog layout — just
|
|
without the .NET runtime.
|
|
|
|
Why: the WinForms build's self-contained publish is ~150MB and pays CLR
|
|
startup cost on every single `ssh://` link click. This version has no
|
|
runtime, no GC, no JIT — cold start is just process creation plus a native
|
|
dialog box. Release build is ~250KB.
|
|
|
|
## Building
|
|
|
|
Cross-compiling from Linux (what CI does):
|
|
|
|
```sh
|
|
rustup target add x86_64-pc-windows-gnu
|
|
sudo apt install mingw-w64
|
|
cargo build --release --target x86_64-pc-windows-gnu
|
|
```
|
|
|
|
Or natively on Windows with the MSVC toolchain:
|
|
|
|
```sh
|
|
cargo build --release
|
|
```
|
|
|
|
The dialog is a native Win32 resource (`resources/ssh_handler.rc`), compiled
|
|
via `embed-resource` in `build.rs` — no GUI toolkit dependency.
|
|
|
|
## Behavior
|
|
|
|
- No arguments: setup mode. Checks for admin rights, confirms with the user,
|
|
then writes the `ssh://` protocol registration under `HKEY_CLASSES_ROOT`.
|
|
- `ssh://user@host` argument: handler mode. Parses the target (defaulting the
|
|
username to the current Windows user if omitted), shows a small dialog to
|
|
confirm/edit the target and optionally enable "legacy mode" (older
|
|
KEX/HostKey/MAC/cipher algorithms for old SSH servers), then launches
|
|
`ssh.exe -A -C ... user@host` via `ShellExecuteW`.
|