Files
alknet/tasks/client/connect-options.md
glm-5.1 5c820a41e9 tasks: decompose Phase 0a ADR foundation and mark prior tasks completed
Add 10 new tasks under tasks/architecture/ for Phase 0a (ADR writing):
- 9 ADR tasks (026-034) with dependency-ordered structure
- 1 review checkpoint task before Phase 0b spec writing

ADR dependency graph (3 generations):
  Gen 1 (parallel): 026, 029, 030, 031, 032, 034
  Gen 2 (depends on 029): 027, 028
  Gen 3 (depends on 027+028): 033
  Gen 4: review checkpoint

Also mark all 34 prior implementation tasks as completed — they
were finished but still showing as pending in the taskgraph.
2026-06-07 08:55:33 +00:00

2.3 KiB

id, name, status, depends_on, scope, risk, impact, level
id name status depends_on scope risk impact level
client/connect-options Implement ConnectOptions struct and client session orchestration with graceful shutdown completed
client/channel-manager
client/socks5-server
client/port-forwarding
transport/trait-and-types
moderate medium component implementation

Description

Implement ConnectOptions — the programmatic configuration struct (ADR-011) for the client — and the top-level client session orchestrator that ties together transport, channel manager, SOCKS5 server, and port forwards.

The client session lifecycle:

  1. Create transport based on ConnectOptions
  2. Connect transport, authenticate SSH session
  3. Start SOCKS5 server
  4. Start port forward listeners
  5. Run until SIGTERM/SIGINT or fatal error
  6. Graceful shutdown

Graceful shutdown (SIGTERM/SIGINT):

  1. Stop accepting new SOCKS5 connections and port forward connections
  2. Send SSH disconnect message to server
  3. Wait for in-flight data to drain (~2 second timeout)
  4. Close transport stream
  5. Exit

Acceptance Criteria

  • crates/alknet-core/src/client/mod.rs re-exports all client components
  • ConnectOptions struct with fields matching client.md CLI interface: server, peer, transport_mode, identity, socks5_addr, forwards, remote_forwards, proxy, iroh_relay, tls_server_name, insecure
  • ConnectOptions::identity accepts KeySource (file or in-memory)
  • ClientSession::new(opts: ConnectOptions) -> Result<Self> — creates transport, connects, authenticates
  • ClientSession::run() — starts SOCKS5 server, port forwards, waits for shutdown signal
  • SOCKS5 is always enabled when running (per constraint)
  • Port forwards are optional and started based on ConnectOptions
  • ClientSession::shutdown() — graceful shutdown: stop accepting, send SSH disconnect, drain timeout, close
  • SIGTERM/SIGINT handled via tokio signal
  • Integration test: full client-to-server session via mock transport, SOCKS5 proxy works, shutdown completes

References

  • docs/architecture/client.md — full client spec, CLI interface, graceful shutdown
  • docs/architecture/decisions/011-no-ssh-config-programmatic-api.md — ConnectOptions programmatic struct

Notes

To be filled by implementation agent

Summary

To be filled on completion