Skip to content

Commit 0be5948

Browse files
madeyeclaude
andcommitted
Add TUI setup wizard, CLI subcommands, and project docs
Add an interactive terminal UI (ratatui + crossterm) for generating config.yaml via `https-proxy setup`. Refactor CLI to use clap subcommands (setup/run), add Serialize to config structs with a save method, and include README and CLAUDE.md. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b9a69ca commit 0be5948

File tree

7 files changed

+1018
-21
lines changed

7 files changed

+1018
-21
lines changed

CLAUDE.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Build Commands
6+
7+
```bash
8+
cargo build # dev build
9+
cargo build --release # release build (stripped, LTO)
10+
cargo check # type-check without building
11+
cargo clippy # lint
12+
```
13+
14+
No tests exist yet. No CI pipeline.
15+
16+
## Architecture
17+
18+
Stealth HTTPS forward proxy that auto-obtains TLS certs via ACME/Let's Encrypt and disguises itself as a normal nginx web server.
19+
20+
### Request Flow
21+
22+
1. **TLS accept** (`tls.rs`): ACME acceptor handles TLS-ALPN-01 challenges transparently; regular connections get a TLS stream with auto-renewed Let's Encrypt cert.
23+
2. **Stealth gate** (`stealth.rs`): Non-proxy requests (no absolute URI, no CONNECT) → fake nginx 404.
24+
3. **Auth gate** (`auth.rs`): Invalid/missing `Proxy-Authorization: Basic ...` → same fake 404 (not 407, to avoid revealing it's a proxy).
25+
4. **CONNECT tunnel** (`proxy.rs`): `hyper::upgrade::on()` + `tokio::io::copy_bidirectional` to target.
26+
5. **HTTP forward** (`proxy.rs`): Rewrites absolute URI to path-only, strips proxy headers, forwards via `hyper::client::conn::http1`.
27+
28+
### Key Design Decisions
29+
30+
- **Stealth over standards**: Auth failures return 404, not 407. The proxy is indistinguishable from a misconfigured nginx to scanners.
31+
- **hyper 1.x with upgrades**: `http1::Builder` must use `.with_upgrades()` for CONNECT tunneling to work.
32+
- **Proxy detection**: `req.uri().authority().is_some()` (absolute URI) or `Method::CONNECT`.
33+
- **ACME on port 443 only**: Uses TLS-ALPN-01 challenge type, no port 80 listener needed.
34+
- **tokio-rustls-acme v0.6 API**: `AcmeState` is a `Stream`; drive it with `StreamExt::next()` in a spawned task. `start_handshake.into_stream(rustls_config)` requires an `Arc<ServerConfig>` built with `state.resolver()`.
35+
36+
## Config
37+
38+
Copy `config.example.yaml` to `config.yaml`. Structure: `listen`, `domain`, `acme` (email, staging bool, cache_dir), `users` (username/password list), `stealth` (server_name).

0 commit comments

Comments
 (0)