How chi11321/crabport works
Purpose and executable entry
CrabPort is a cross-platform native desktop SSH, SFTP, Telnet, local-terminal, and tunnel client. The workspace executable starts at src/main.rs; workspace/package composition and build metadata are rooted in Cargo.toml and build.rs. The primary runtime UI is GPUI-based, not a web application.
UI application shell and state
crabport-ui owns application orchestration, window lifecycle, persistent UI state, navigation, and views. crabport-ui/src/app.rs is the application shell; crabport-ui/src/app_state.rs holds app-level state; crabport-ui/src/app/connection.rs coordinates connection-oriented UI actions. Windows, tabs, sidebars, panels, and dialogs sit above protocol crates rather than implementing network protocols.
Connection/session dispatch
The UI creates and manages multi-tab sessions across SSH, Telnet, and terminal modes. Session creation forms and proxy/certificate variants are in crabport-ui/src/views/sessions.rs, crabport-ui/src/views/sessions/form.rs, and crabport-ui/src/views/sessions/with_proxy.rs. This is the boundary where saved host, credential, proxy, and tunnel configuration becomes a live protocol session.
SSH, Telnet, and terminal runtime
SSH behavior is encapsulated in crabport-ssh, using russh: backend/session ownership, handlers, host-key handling, and monitoring are separated in crabport-ssh/src/backend.rs, crabport-ssh/src/session.rs, and crabport-ssh/src/known_hosts.rs. Telnet has an isolated backend/session implementation in crabport-telnet/src/backend.rs and crabport-telnet/src/session.rs. Terminal emulation and PTY integration are centralized in crabport-terminal/src/terminal.rs and crabport-terminal/src/pty.rs, with terminal rendering/UI integration in crabport-ui/src/views/terminal.rs.
File transfer and remote file management
SFTP is a dedicated crate layered over the SSH connection path. crabport-sftp/src/backend.rs provides the protocol-facing backend; crabport-sftp/src/api.rs exposes operations; crabport-sftp/src/transfer.rs handles transfer work. UI browsing, drag/drop, and transfer history are in crabport-ui/src/views/sftp.rs, crabport-ui/src/views/sftp/drag.rs, and crabport-ui/src/views/sftp/transfer_history.rs. SSH also contains lower-level transfer support under crabport-ssh/src/transfer.rs.
Tunnels and proxies
Port forwarding is isolated behind crabport-tunnel/src/lib.rs, while SSH-specific tunnel integration lives in crabport-ssh/src/crabport_tunnel.rs. Proxy behavior is exposed as crabport-proxy/src/lib.rs. Tunnel state and management screens are in crabport-ui/src/views/tunnels.rs and crabport-ui/src/views/tunnels/state.rs; these configurations can be attached to host/session setup.
Persistence, security, and configuration
crabport-core is the shared domain/persistence layer. SQLite-backed entities and commands—including hosts, credentials, proxies, tunnels, groups, and snippets—are organized in crabport-core/src/store.rs, crabport-core/src/store/hosts.rs, and crabport-core/src/store/credentials.rs. Credentials are locally encrypted with AES-256-GCM through crabport-core/src/crypto.rs and key material management in crabport-core/src/credential.rs. App configuration is managed separately in crabport-core/src/config.rs. Data resides in platform-standard app-data locations as SQLite database, encryption key, and TOML config.
Runtime and platform boundaries
Rust 2024 / Rust 1.91+ is the core runtime. Async/network work uses Tokio and smol; SSH/SFTP use russh and russh-sftp; terminal emulation uses alacritty_terminal. GPUI provides GPU-rendered desktop UI across macOS, Linux, and Windows. Platform packaging is driven by build.rs, crabport-ui/build.rs, and CI release workflows in .github/workflows/release.yml.
Main entry points: app.rs Application shell · connection.rs Connection actions · sessions.rs Session setup · tunnels.rs Tunnel management
Components 19
Desktop UI
GPUI application and connection-facing views.
- Application shell · Owns window lifecycle, navigation, and orchestration.
crabport-ui/src/app.rs - Persistent UI state
crabport-ui/src/app_state.rs - Connection actions · Turns saved setup into live session actions.
crabport-ui/src/app/connection.rs - Session setup · Forms support connection, proxy, and certificate variants.
crabport-ui/src/views/sessions.rs - Terminal view
crabport-ui/src/views/terminal.rs - SFTP workspace · Remote browsing, drag/drop, and transfer history.
crabport-ui/src/views/sftp.rs - Tunnel management
crabport-ui/src/views/tunnels.rs
Session runtimes
Protocol, terminal, transfer, and tunnel execution.
- SSH runtime · Owns SSH sessions, handlers, host keys, and monitoring.
crabport-ssh/src/backend.rs - Telnet runtime
crabport-telnet/src/backend.rs - Terminal and PTY · Central terminal emulation and PTY integration.
crabport-terminal/src/terminal.rs - SFTP backend · Protocol backend, API, and transfer work over SSH.
crabport-sftp/src/backend.rs - Port forwarding
crabport-tunnel/src/lib.rs - Proxy support
crabport-proxy/src/lib.rs
Data and security
Shared persistence, credentials, and configuration.
- SQLite domain store · Stores hosts, credentials, proxies, tunnels, groups, and snippets.
crabport-core/src/store.rs - Credential security · Encrypts local credentials and manages key material.
crabport-core/src/crypto.rs - App configuration
crabport-core/src/config.rs
Other components
- Desktop executable
src/main.rs - Workspace build
Cargo.toml - Platform packaging
build.rs
Connections 22
- Workspace build → Desktop executable: builds
- Platform packaging → Desktop executable: packages
- Desktop executable → Application shell: starts
- Application shell → Persistent UI state: owns
- Application shell → Connection actions: routes actions
- Application shell → Terminal view: renders
- Application shell → SFTP workspace: renders
- Application shell → Tunnel management: renders
- Connection actions → Session setup: uses setup
- Session setup → SQLite domain store: loads saved setup
- Connection actions → SSH runtime: opens SSH
- Connection actions → Telnet runtime: opens Telnet
- Connection actions → Terminal and PTY: opens local terminal
- Terminal view → Terminal and PTY: renders terminal
- SFTP workspace → SFTP backend: file operations
- SFTP backend → SSH runtime: uses SSH path
- Tunnel management → Port forwarding: manages
- SSH runtime → Port forwarding: integrates forwarding
- Session setup → Proxy support: attaches proxy
- SQLite domain store → Credential security: secures credentials
- Application shell → App configuration: loads settings
- Tunnel management → SQLite domain store: persists tunnels