Commit Graph
7 Commits
Author SHA1 Message Date
c4ch3c4d3andfactory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> 32a29c89f2 feat: fix flaky generate test and format tunnel.rs
- Fix race condition in generate test temp_dir() by using PID + atomic counter
  instead of nanosecond timestamps that collide under parallel test execution
- Apply cargo fmt to tunnel.rs for consistent formatting

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-06-04 08:29:24 -06:00
c4ch3c4d3andfactory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> 10b8b24dce feat: add operational reconnect and shutdown handling
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-06-04 08:25:36 -06:00
c4ch3c4d3andfactory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> d6a0a40696 Replace HTTP-shaped forwarding with true persistent multiplexed tunnel
Fix socks-e2e scrutiny blockers by replacing HTTP-shaped request/response
forwarding with a true persistent authenticated tunnel data path.

Key changes:
- Implement bidirectional framing with stream IDs over the authenticated
  tunnel so SOCKS target TCP connections originate from the listener side
- Multiple sequential/concurrent SOCKS streams share one authenticated
  session with stream isolation via frame dispatch
- Bytes stream incrementally without whole-response buffering or fixed EOF
  timeouts
- CLOSE/ERROR frames propagate deterministically for clean stream teardown
- Remove /forward HTTP endpoint and TunnelSession HTTP-based forwarding
- Remove read_until_double_crlf HTTP-specific parsing from SOCKS path
- Add StreamMux for concurrent stream management on the connector side
- Add tests for slow/interleaved streams, concurrent isolation,
  listener-side target origin, close frame propagation, and E2E framing

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-06-03 21:01:24 -06:00
c4ch3c4d3 f871ba7f7b Replace per-SOCKS-request HTTPS connections with persistent multiplexed tunnel session
- Introduce TunnelSession that holds a single authenticated SendRequest
  shared across all concurrent SOCKS5 streams via Arc<Mutex<>>
- Connector authenticates once on startup, then reuses the persistent
  tunnel for all SOCKS5 CONNECT requests
- Listener /forward returns raw bytes (no HTTP parse/unparse overhead)
  to preserve exact byte semantics for SOCKS5 TCP proxying
- Add stream counters (session-X) for logging and isolation tracking
- Add 5 new tests: sequential streams, concurrent streams with isolation,
  stream counter increments, pre-auth rejection, and E2E concurrent SOCKS5
  streams over a shared tunnel
- All 117 tests pass; E2E CLI validates 5 concurrent streams share one
  persistent TLS connection (127.0.0.1:64216 in transcript)
2026-06-03 20:17:39 -06:00
c4ch3c4d3andfactory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> 6466753176 feat: implement SOCKS5 proxy with stream multiplexing over HTTPS tunnel
- Add socks5.rs module with SOCKS5 protocol parsing (greeting, auth, CONNECT)
- Add /forward HTTPS endpoint on listener for target TCP forwarding
- Add SOCKS5 proxy listener on connector side with fail-closed auth gating
- Support IPv4 and hostname targets, sequential/concurrent streams
- Fail-closed behavior: SOCKS rejected before tunnel authentication
- 38 new tests covering protocol parsing, malformed input, and E2E paths

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-06-03 19:59:26 -06:00
c4ch3c4d3 76bda0bc5b fix: address secure-tunnel scrutiny findings 2026-06-03 19:15:48 -06:00
c4ch3c4d3 393100de5a feat: implement HTTPS mTLS tunnel with auth handshake
Add HTTPS default tunnel endpoint and outbound connector using Rustls
with mTLS and an additional auth/session token.

- Add rustls, tokio-rustls, hyper, and related dependencies
- Implement TLS config builders (server/client) with cert validation
- Implement HTTPS tunnel listener with mTLS accept and auth handshake
- Implement HTTPS tunnel connector with server cert validation
- Add auth token loading from CLI value or file
- Add security gate state machine for tracking auth progression
- Fail closed for missing/invalid TLS config, cert mismatch, auth failures
- Port conflicts fail without fallback
- Reconnect revalidates all security gates
- 67 tests covering all validation assertions
2026-06-03 18:29:15 -06:00