Skip to main content

Crate ssh_commander_core

Crate ssh_commander_core 

Source
Expand description

ssh-commander-core: Rust domain layer for R-Shell.

This crate owns all connection and protocol logic: SSH, PTY lifecycle, host-key handling, connection manager, SFTP, FTP, desktop protocol (RDP/VNC), and Keychain integration.

§Thread Safety

  • ConnectionManager: Send + Sync. All public methods are async. Callers must be running inside a Tokio runtime. Internally uses Arc<RwLock<HashMap>> — fine to call from any task, but the task must live on the Tokio runtime.
  • SshClient: Send (not Sync). Single-owner state; wrap in Arc<RwLock<SshClient>> to share across tasks (as ConnectionManager does).
  • StandaloneSftpClient, FtpClient: Same pattern as SshClient.
  • HostKeyStore: Send + Sync. Uses tokio::sync::Mutex internally. Safe to share via Arc.
  • keychain module: Synchronous only. Do not call from a Tokio spawn_blocking is fine; do not hold an .await across a keychain call.
  • PtySession: Send. The output_rx field is Arc<Mutex<Receiver>> for sharing. input_tx and resize_tx are cloneable Senders.
  • DesktopProtocol trait: Requires Send + Sync. Implementations (RdpClient, VncClient) are Send (not Sync) — wrap in Arc<RwLock<Box<dyn DesktopProtocol>>>.

Re-exports§

pub use connection_manager::ConnectionManager;
pub use connection_manager::ManagedConnection;
pub use connection_manager::ProtocolKind;
pub use desktop_protocol::DesktopConnectRequest;
pub use desktop_protocol::DesktopConnectResponse;
pub use desktop_protocol::DesktopKind;
pub use desktop_protocol::DesktopProtocol;
pub use desktop_protocol::FrameUpdate;
pub use desktop_protocol::RdpConfig;
pub use desktop_protocol::VncConfig;
pub use event_bus::CoreEvent;
pub use file_entry::FileEntry;
pub use file_entry::FileEntryType;
pub use file_entry::RemoteFileEntry;
pub use sftp_client::SftpAuthMethod;
pub use sftp_client::SftpConfig;
pub use sftp_client::StandaloneSftpClient;
pub use ssh::AuthMethod;
pub use ssh::CommandOutput;
pub use ssh::HostKeyMismatch;
pub use ssh::HostKeyStore;
pub use ssh::HostKeyStoreAccessError;
pub use ssh::HostKeyVerificationFailure;
pub use ssh::PtySession;
pub use ssh::SshClient;
pub use ssh::SshConfig;
pub use ssh::SshTunnel;
pub use ssh::SshTunnelRef;
pub use tools::DnsAnswer;
pub use tools::DnsQuery;
pub use tools::GitStatus;
pub use tools::ListeningPort;
pub use tools::TcpdumpEvent;
pub use tools::TcpdumpRegistry;
pub use tools::ToolsError;
pub use tools::dns_resolve_local;
pub use tools::dns_resolve_remote;
pub use tools::git_status;
pub use tools::listening_ports;
pub use ssh_commander_keychain as keychain;
pub use ssh_commander_pg as postgres;

Modules§

connection_manager
desktop_protocol
event_bus
Event bus — a single channel for all async-to-sync boundary crossings.
file_entry
Protocol-agnostic file listing types and transfer tuning shared by the SFTP and FTP clients.
ftp_client
rdp_client
sftp_client
ssh
tools
Network/dev tools surface — features that ride on top of an existing SSH connection without requiring a separate protocol implementation.
vnc_client

Structs§

ActiveCursor
Server-side cursor metadata. Held by the client when a query has remaining rows; consumed (closed) on close_query or when the next execute call supersedes it.
ColumnDetail
Per-column metadata used by the INSERT form to pre-set Use DEFAULT and NULL toggles. Read from pg_attribute joined with pg_attrdef for the default-presence flag.
ColumnMeta
DbSummary
ExecutionOutcome
InsertColumnInput
One column’s worth of input for an INSERT. Caller emits a list of these for the columns it wants to set explicitly; columns not in the list are left to the server’s DEFAULT (which honors pg_attrdef-defined defaults, sequences, generated values, etc).
InsertedRow
ObjectType
PageResult
PgConfig
PgPool
Relation
Routine
SchemaContents
Unified schema-contents view used by the tree’s “expand a schema” path. Six-way grouping mirrors DataGrip’s tree. Tables include regular, partitioned, and foreign tables (all “data-bearing relations”); views and materialized views split out for clarity.
SchemaSummary
Sequence
UpdateOutcome

Enums§

CredentialKind
Kinds of credential we persist. Serialised in snake_case on the wire so the frontend can emit e.g. {"kind": "ssh_password"}.
ObjectTypeKind
PgAuthMethod
How to authenticate to the Postgres server.
PgError
Errors surfaced from the Postgres explorer layer.
PgTlsMode
TLS posture for the connection.
RelationKind
Discriminator for tables / views / matviews / partitioned tables / foreign tables. Matches pg_class.relkind values that an explorer cares about. Sequences, indexes, composite types, and TOAST relations are excluded from list_relations and so do not appear here.
RoutineKind

Constants§

BROWSER_SESSION_ID
Stable session id used for the schema browser’s introspection calls (list_databases, list_schemas, list_relations). Uses a name that can’t collide with a UUID-generated tab session id.

Functions§

core_version
delete_password
is_supported
Whether this build can actually read / write the OS keychain. The frontend uses this to hide “Save to Keychain” UI on unsupported platforms instead of letting the save call error at runtime.
list_accounts
List all accounts stored under a given kind’s service. Returns an empty vector (not an error) when no entries exist or the platform has no keychain. Useful for the Settings UI to show the user what’s saved.
load_password
save_password