rust-expect 0.1.0

Next-generation Expect-style terminal automation library for Rust
Documentation
# rust-expect SSH Environment Configuration
# ==========================================
#
# This file documents environment variables for SSH testing and automation.
# Copy to .env and customize for your environment.
# NEVER commit the .env file with real credentials.

# SSH Connection
# --------------
# Target SSH server hostname or IP
SSH_HOST=localhost

# SSH port (default: 22)
SSH_PORT=22

# Username for SSH authentication
SSH_USER=testuser

# SSH Authentication
# ------------------
# Password authentication (use with caution, prefer keys)
# SSH_PASSWORD=your_password_here

# Path to private key file (supports OpenSSH format)
SSH_PRIVATE_KEY=~/.ssh/id_ed25519

# Passphrase for encrypted private keys (if applicable)
# SSH_KEY_PASSPHRASE=your_passphrase_here

# Use SSH agent for authentication (set to "true" to enable)
SSH_USE_AGENT=true

# SSH Options
# -----------
# Connection timeout in seconds
SSH_CONNECT_TIMEOUT=30

# TCP keepalive interval in seconds (0 to disable)
SSH_KEEPALIVE=60

# Enable compression (set to "true" to enable)
SSH_COMPRESSION=false

# Host Key Verification
# ---------------------
# Host key verification policy:
#   strict        - Reject unknown hosts (recommended for production)
#   known_hosts   - Use known_hosts file
#   accept_all    - Accept any host key (DANGEROUS, requires insecure-skip-verify feature)
SSH_HOST_KEY_POLICY=strict

# Path to known_hosts file (when using known_hosts policy)
SSH_KNOWN_HOSTS=~/.ssh/known_hosts

# Testing Configuration
# ---------------------
# Skip SSH tests if no server is available
SSH_SKIP_TESTS=false

# Test command to run after connection
SSH_TEST_COMMAND=echo "SSH connection successful"

# Jump Host (Bastion) Configuration
# ---------------------------------
# Enable jump host (set to "true" to enable)
# SSH_JUMP_ENABLED=false

# Jump host connection details
# SSH_JUMP_HOST=bastion.example.com
# SSH_JUMP_PORT=22
# SSH_JUMP_USER=jump_user

# Example Usage
# =============
#
# In your Rust code:
#
#   use std::env;
#
#   let host = env::var("SSH_HOST").unwrap_or_else(|_| "localhost".into());
#   let user = env::var("SSH_USER").unwrap_or_else(|_| whoami::username());
#   let port: u16 = env::var("SSH_PORT")
#       .ok()
#       .and_then(|s| s.parse().ok())
#       .unwrap_or(22);
#
#   let credentials = SshCredentials::new(user)
#       .with_agent()
#       .with_key(env::var("SSH_PRIVATE_KEY").unwrap_or_else(|_| "~/.ssh/id_rsa".into()));
#
#   let session = SshSessionBuilder::new()
#       .host(host)
#       .port(port)
#       .credentials(credentials)
#       .connect()
#       .await?;