sendback 0.1.1

Send files back through your SSH session via reverse tunnel
Documentation
# sendback

**Send files back through your SSH session.**

```bash
# On any server you're SSH'd into:
sendback results.tar.gz
# → File appears in ~/Downloads on your laptop
```

No scp paths, no NAT issues, no firewall hassles.

## Installation

### Option 1: Pre-built binaries (easiest)

**On your laptop (macOS/Linux, system-wide):**
```bash
curl -sSL https://raw.githubusercontent.com/yipihey/sendback/main/scripts/install.sh | bash
```
This installs to `/usr/local/bin/sendback` (requires sudo).

**On servers (no sudo required):**
```bash
curl -sSL https://raw.githubusercontent.com/yipihey/sendback/main/scripts/install.sh | bash -s -- --local
```
This installs to `~/.local/bin/sendback`. Make sure `~/.local/bin` is in your PATH:
```bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
```

### Option 2: Install via Cargo (crates.io)

Requires [Rust](https://rustup.rs/) (install with `curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh`).

```bash
cargo install sendback
```

**Where does it install?**
- Binary goes to `~/.cargo/bin/sendback`
- No build files are left behind (cargo cleans up automatically)
- Make sure `~/.cargo/bin` is in your PATH (rustup adds this during installation)

**To update later:**
```bash
cargo install sendback --force
```

### Option 3: Clone and build manually

```bash
git clone https://github.com/yipihey/sendback.git
cd sendback
cargo build --release
# Binary is at ./target/release/sendback
# Copy it wherever you want, or run: cargo install --path .
```

**Build artifacts:** The `target/` directory contains build files (~500MB).
You can delete it after copying the binary, or add it to `.gitignore` (already done).

## Quick Start

### 1. On your laptop — start the listener

```bash
sendback listen              # Run in a terminal (keep it open), or:
sendback service install     # Auto-start on login (background)
```

### 2. Connect to servers with the reverse tunnel

```bash
ssh -R 19283:localhost:19283 yourserver
```

**Pro tip:** Add an alias to `~/.bashrc` or `~/.zshrc`:
```bash
alias sshr='ssh -R 19283:localhost:19283'
```
Then just use `sshr yourserver`.

### 3. Send files back

```bash
sendback file.tar.gz         # Single file
sendback *.log               # Multiple files
sendback check               # Verify tunnel works
```

Files appear in `~/Downloads` on your laptop (configurable).

## Features

- **Zstd compression** — faster transfers over slow connections
- **Resume support** — interrupted transfers continue where they left off
- **Transfer history**`sendback history` shows past transfers
- **Multi-hop friendly** — works with jump hosts/bastions
- **Secure** — SSH-encrypted, localhost-only, checksum-verified

## Troubleshooting

```bash
sendback check               # Run on server — diagnose tunnel issues
sendback doctor              # Run on laptop — health check
```

Common issues:
- **"Nothing listening"** — Start `sendback listen` on your laptop
- **"Connection refused"** — Connect with `-R 19283:localhost:19283`
- **"Early EOF"** — Version mismatch; update sendback on both machines

## Configuration

```bash
sendback config --show                    # View current config
sendback config --download-dir ~/Documents
sendback config --compression false
```

Config file location: `~/.config/sendback/config.toml`

## How It Works

```
LAPTOP                              SERVER
┌──────────────┐                   ┌──────────────┐
│  sendback    │ ◄──────────────── │  sendback    │
│  (listen)    │   SSH reverse     │  file.tar.gz │
│  :19283      │   tunnel (-R)     │              │
└──────────────┘                   └──────────────┘
```

SSH's `-R` flag creates a reverse tunnel from server back to laptop.
sendback streams files through this encrypted tunnel.

## Uninstalling

**If installed via cargo:**
```bash
cargo uninstall sendback
```

**If installed via install script:**
```bash
rm /usr/local/bin/sendback      # system-wide install
# or
rm ~/.local/bin/sendback        # local install
```

**Config and data:**
```bash
rm -rf ~/.config/sendback       # config file
rm -rf ~/.local/share/sendback  # transfer history
```

## Feedback

Questions, bugs, or feature requests: **sendback@tomabel.org**

GitHub: https://github.com/yipihey/sendback

## License

MIT