This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
git config core.hooksPath .githooks # enable pre-commit fmt checkcargo build # dev build
cargo build --release # release build (stripped, LTO)
cargo check # type-check without building
cargo clippy # lint
cargo test # run all integration tests
cargo test --test stealth_tests # run specific test fileStealth HTTPS forward proxy that auto-obtains TLS certs via ACME/Let's Encrypt and disguises itself as a normal nginx web server.
- TLS accept (
tls.rs): ACME acceptor handles TLS-ALPN-01 challenges transparently; regular connections get a TLS stream (HTTP/1.1 or HTTP/2) with auto-renewed Let's Encrypt cert. - Stealth gate (
stealth.rs): Non-proxy requests (no absolute URI, no CONNECT) → fake nginx 404. - Auth gate (
auth.rs): Proxy requests with invalid/missingProxy-Authorization: Basic ...→ 407 withProxy-Authenticateheader (enables browser auth prompts). Non-proxy requests → fake 404. - CONNECT tunnel (
proxy.rs):hyper::upgrade::on()+tokio::io::copy_bidirectionalto target. - HTTP forward (
proxy.rs): Rewrites absolute URI to path-only, strips proxy headers, forwards viahyper::client::conn::http1.
- Stealth for non-proxy traffic: Non-proxy requests (no absolute URI, no CONNECT) return nginx 404. Proxy requests with missing/wrong auth get 407 so real clients (Chrome) can authenticate.
- HTTP/2 extended CONNECT:
enable_connect_protocol()(RFC 8441) enables browser proxy compatibility (Chrome, Firefox). - hyper 1.x with upgrades:
http1::Buildermust use.with_upgrades()for CONNECT tunneling to work. - Proxy detection:
req.uri().authority().is_some()(absolute URI) orMethod::CONNECT. - ACME on port 443 only: Uses TLS-ALPN-01 challenge type, no port 80 listener needed.
- tokio-rustls-acme v0.6 API:
AcmeStateis aStream; drive it withStreamExt::next()in a spawned task.start_handshake.into_stream(rustls_config)requires anArc<ServerConfig>built withstate.resolver().
Copy config.example.yaml to config.yaml. Structure: listen, domain, acme (email, staging bool, cache_dir), users (username/password list), stealth (server_name).