Skip to main content

Module constants

Module constants 

Source
Expand description

Named domain constants (XDG file names, env keys, network/timing defaults). Named domain constants (Rules Rust — proibição de hardcode).

Compile-time values with semantic names live here. Runtime host credentials, per-VPS timeouts, and primary-key material are never hardcoded: they are loaded once from CLI / OS keyring / XDG files under [APP_NAME] (directories::ProjectDirs + optional --config-dir).

§12-Factor alignment (this product)

FactorHow ssh-cli applies it
III ConfigHosts in XDG config.toml; secrets via CLI flags / keyring / secrets.key (not SSH_CLI_* env stores)
Build/Release/RunVersion from CARGO_PKG_VERSION; commit via build.rs; no prod URL in binary
Backing servicesSSH endpoints are user registry data, not compile-time constants

Modules keep local constants when the name is only meaningful in that module (e.g. concurrency RAM budget). Cross-cutting identity, storage file names, env var names, network defaults, and process timing are centralized.

Constants§

ACTIVE_VPS_FILE_NAME
Active-VPS marker file name (sibling of CONFIG_FILE_NAME).
AEAD_NONCE_LEN_BYTES
ChaCha20-Poly1305 nonce length in bytes.
AEAD_TAG_LEN_BYTES
Poly1305 authentication tag length in bytes.
AGENT_RETRY_BASE_MS
Base backoff delay (ms) for agent full-jitter formula.
AGENT_RETRY_MAX_DELAY_MS
Ceiling for a single agent backoff sleep (ms).
AGENT_RETRY_MAX_RETRIES
Max retries after the first failure for agents re-invoking on exit 74.
APP_NAME
Binary and project name (clap, keyring service, XDG directory leaf).
CONFIG_FILE_NAME
Registry file name under the config directory.
DEFAULT_SSH_PORT
Default SSH port when the user omits --port on vps add.
DEFAULT_TUNNEL_BIND_ADDR
Default local bind for tunnel --bind (loopback-only for safety).
ENV_FORCE_TEXT
Historical name only — not read as product store. Use --json / --output-format text.
ENV_HOME
Historical name only — not read as product config store. Use CLI --config-dir for isolated config roots.
ENV_LANG
Historical name only — not read as product store. Use CLI --lang or locale set (XDG lang).
ENV_SECRETS_KEY
Hex primary-key material. Fail-closed: presence is rejected (not a store). Use XDG secrets.key, --secrets-key-file, or --use-keyring.
ENV_SECRETS_KEY_FILE
Path to a primary-key file (hex). Fail-closed: presence is rejected (not a store). Use CLI --secrets-key-file or XDG secrets.key.
ENV_USE_KEYRING
Historical name only — prefer CLI --use-keyring (not an env store).
FAN_OUT_SIGNAL_POLL_INTERVAL_MS
Multi-host fan-out signal poll interval inside map_bounded.
HAPPY_EYEBALLS_ATTEMPT_DELAY_MS
Delay before starting the next Happy Eyeballs dial candidate (RFC 8305-inspired).
HARD_CAP
Alias used by the concurrency budget module (same as MAX_CONCURRENCY).
HARD_RETRY_MAX_DELAY_MS
Hard ceiling for a single delay (ms).
HARD_RETRY_MAX_RETRIES
Hard cap on configured retries (prevents accidental retry storms).
IO_OVERSUBSCRIBE
I/O oversubscribe factor vs CPU count for multi-host fan-out.
KEYRING_SERVICE
Keyring service name (must match historical installs).
KEYRING_USER_LEGACY
Legacy keyring user (read-only migration alias).
KEYRING_USER_PRIMARY
Canonical keyring user for the primary key.
KNOWN_HOSTS_FILE_NAME
TOFU host-key store file name (sibling of CONFIG_FILE_NAME).
LANG_PREFERENCE_FILE_NAME
Persisted UI language preference file name (sibling of CONFIG_FILE_NAME).
MAX_CONCURRENCY
Hard upper bound on concurrent multi-host sessions and SCP file channels.
MIN_CONCURRENCY
Minimum concurrent multi-host / fan-out units (always ≥ 1).
NON_LINUX_CPU_CAP
Conservative CPU×IO cap when free RAM cannot be read (non-Linux).
PRIMARY_KEY_HEX_LEN
Primary-key hex encoding length (2 * PRIMARY_KEY_LEN_BYTES).
PRIMARY_KEY_LEN_BYTES
Primary-key length in bytes.
PROJECT_ORGANIZATION
directories::ProjectDirs::from organization (empty = app-only path).
PROJECT_QUALIFIER
directories::ProjectDirs::from qualifier (empty = no reverse-DNS prefix).
RAM_PER_TASK_BYTES
Documented per multi-host session RAM budget (bytes) for auto concurrency formula.
RUNTIME_SHUTDOWN_TIMEOUT_SECS
Tokio runtime graceful shutdown budget after the one-shot command returns.
SECRETS_KEY_FILE_NAME
Primary-key file name (next to CONFIG_FILE_NAME; mode 0o600).
SECRET_DIR_MODE_UNIX
Unix permission mode for secret directories (TLS identity dirs, etc.).
SECRET_FILE_MODE_UNIX
Unix permission mode for secret files (config.toml, secrets.key, lang).
SFTP_FALLBACK_BASENAME
Basename used only when a multi-file source has no file name component. Prefer rejecting empty names; this is a last-resort label (G-SFTP-R13).
SFTP_IO_CHUNK
Stream chunk size for SFTP file I/O (bytes). Never load whole files into RAM.
SFTP_LIST_MAX_ENTRIES
Fail-closed cap on directory listing entries (sftp ls / recursive walk).
SFTP_MAX_RECURSION_DEPTH
Max recursion depth for sftp upload|download --recursive.
SFTP_SUBSYSTEM
SSH subsystem name for SFTP v3 (request_subsystem).
SSH_CLIENT_ID
SSH identification string sent to the server (G-SSH-02).
SSH_KEEPALIVE_INTERVAL_SECS
SSH-level keepalive interval (seconds between keepalives when idle).
SSH_KEEPALIVE_MAX
Max unanswered SSH keepalives before russh closes the session.
SSH_MAX_PACKET_SIZE
Maximum SSH packet size (32 KiB — RFC 4253 common default).
SSH_REKEY_BYTE_LIMIT
Rekey after this many bytes read or written (1 GiB — RFC 4253 §9).
SSH_REKEY_TIME_SECS
Rekey after this many seconds of session lifetime (RFC 4253 §9).
SSH_RSA_MIN_BITS
Minimum RSA private-key size accepted for publickey auth (bits).
SSH_RSA_PREFERRED_BITS
Preferred RSA size; smaller (but ≥ min) keys log a warning (bits).
SSH_WINDOW_SIZE
Initial SSH channel window size (2 MiB — OpenSSH-class throughput).
TCP_KEEPALIVE_ENABLED
Enable TCP-level SO_KEEPALIVE on the SSH dial socket (complements SSH KA).
TLS_ACME_ACCOUNT_FILE_NAME
ACME account credentials file name (JSON, 0o600).
TLS_ACME_DIR_NAME
Subdirectory of TLS_DIR_NAME for ACME account + issued certificates.
TLS_ACME_ORDER_FILE_NAME
Pending ACME order state file name (agent two-step DNS-01 flow).
TLS_CERT_FILE_NAME
Certificate chain PEM file name under an ACME/mTLS identity directory.
TLS_DIR_NAME
XDG subdirectory for TLS material (mTLS client certs, ACME account/certs).
TLS_KEY_FILE_NAME
Private key PEM file name under an ACME/mTLS identity directory.
TLS_MTLS_DIR_NAME
Subdirectory of TLS_DIR_NAME for imported mTLS client identities.
TUNNEL_CHANNEL_ORIGIN_ADDR
Origin address advertised on SSH direct-tcpip channels for local forwards.
TUNNEL_CHANNEL_ORIGIN_PORT
Origin port advertised on SSH direct-tcpip channels (0 = ephemeral/unspecified).
TUNNEL_FORWARD_DRAIN_TIMEOUT_SECS
Grace period to drain in-flight tunnel forwards after stop.
TUNNEL_SIGNAL_POLL_INTERVAL_MS
Tunnel accept-loop cooperative signal poll interval.
WINDOWS_SSH_AGENT_PIPE
Windows OpenSSH agent named pipe (platform default when --use-agent has no path).