- docs/architecture/: README index, overview, wire, producer, consumer, vendor, bast specs + open-questions.md (the OQ-SK-01..09 ledger promoted; new questions as OQ-SK2-06..) - ADRs 001-012: ALPN/op/params, protocol base, the handle swap, the dial-callback shape, auth split by the door, access control (open gate + BIND command gate), BIND in base, provider defaults, feature gates, channel capacity, the inline vendor, target policy - deferred OQs (SK2-06, SK2-07) with tracker tasks in tasks/architecture/ per the sdd_process deferred-OQ protocol - review pass applied: frame-length joint bound (65766 corner), accept_no_auth vs skip_auth corrected against fast-socks5 source, composed-feature wasm posture, cross-reference fixes Verified: cross-references (all ADR/OQ refs resolve), doc sizes under split threshold, Phase 0 fidelity spot-checks
status: draft last_updated: 2026-09-20 (Phase 1 initial draft — the OQ-SK ledger promoted into ADRs 001-012 and open-questions.md)
alksocks — Architecture
A SOCKS5 (RFC 1928) producer/consumer protocol crate on alkcall
channels: an arbitrary-egress proxy service that never binds a port
unless explicitly configured to — the alk/socks5-family
producer/consumer protocol crate, the sibling of alktty
(alk/tty) and alktunnels (alk/tunnel). Where alktunnels
realizes the -L/-R forwarding flavors, alksocks realizes the
-D flavor (dynamic / SOCKS5 proxy). This directory holds the
architecture spec docs and the ADRs.
Current State
Phase 1 (Architecture) — initial draft. Phase 0
(docs/research/phase-0.md) is converged (2026-09-14) and
POC-complete (all numbered POCs passed or were dropped with the
scope decision); the OQ-SK ledger's Phase 1 inputs are collected and
promoted into ADRs 001–012. All docs are draft — they transition
to reviewed when their open questions resolve and the architecture
review passes. src/ does not exist yet; implementation follows the
decomposition phase.
Documents
| Document | Status | Description |
|---|---|---|
| overview.md | draft | Crate purpose, the resource model in brief, dependencies, feature gates, module map |
| wire.md | draft | The wire format: the open op (trivial params — ADR-001), the phase model, the data planes (CONNECT pass-through / ASSOCIATE frames / BIND phases), sentinels |
| producer.md | draft | The producer half: the session-gate establisher, command dispatch, the three seams (dial/egress/accept), scope gates, the local backend |
| consumer.md | draft | The consumer half: the channels-native sessions (connect/associate/bind), the front doors, door auth (ADR-005), teardown ownership |
| vendor.md | draft | The inline vendor: the vendored fast-socks5 subset's scope, the four carried changes, the maintenance posture |
| bast.md | draft | The BAST document for the ASSOCIATE datagram frame (ADR-003); pass-through stages have no binary framing to describe |
| open-questions.md | draft | Centralized OQ tracker (OQ-SK-01..09 promoted; new questions as OQ-SK2-06.. — the SK2 numbering is not contiguous from 01, working-draft numbers were consumed) |
ADR Table
| ADR | Title | Status |
|---|---|---|
| 001 | ALPN, Open Op, and Trivial Params | Accepted |
| 002 | Protocol Base — the Vendored fast-socks5 Typestate Subset | Accepted |
| 003 | The Handle Swap — one Channel per Association, Frames In-Band | Accepted |
| 004 | The Dial-Callback Shape — Function, not Trait, at Three Seams | Accepted |
| 005 | Auth Mapping — "Both," Split by the Door | Accepted |
| 006 | Access-Control Posture — the Open Gate Plus the Command Gate | Accepted |
| 007 | BIND in the Base Crate — the Phase Model Extended | Accepted |
| 008 | Egress/Accept Provider Defaults — Local Socket and Composed (Direct Op) | Accepted |
| 009 | Feature-Gate Layout — net, local, and the Composition Boundary |
Accepted |
| 010 | Channel Capacity — Proxy-Workload Recommendation, Not a Wire Change | Accepted |
| 011 | the Inline Vendor — fast-socks5's T-Generic Subset, In-Tree |
Accepted |
| 012 | Target Policy and the Virtual-Subnet Translation Layer | Accepted |
Upstream ADRs (alkcall/alktunnels/alknet) are referenced by their own
numbers and are NOT ported — the alkcall originals at
/workspace/@alkdev/alkcall/docs/architecture/decisions/ remain
authoritative for the shared surfaces (establishment, channels wire
format, pump_bidi, identity seam, the channel caps).
Key Design Principles
- The protocol never binds. The SOCKS5 service is a produced, ACL-scoped resource on a channels connection ("ALPN as a service"); kernel binds exist only as the two explicit, optional, feature-gated assembly shapes (the producer's local backend; the consumer's front door). The binding decision belongs to the caller. The UDP ASSOCIATE "bind" is virtualized as the channel (the handle swap, ADR-003).
- The RFC conversation is the data plane. One ALPN, one open op, trivial params (ADR-001); the phase model needs no mode byte — the reply synchronizes the switch; no in-band control vocabulary (the escape hatch is a new ALPN, never a framing change).
- The seams are functions, not traits (ADR-004): DialFn / EgressFactory / BindAcceptFactory at the three I/O planes; the protocol layer never names a substrate type; ownership rides the handle structurally.
- Auth is split by the door (ADR-005): producer = the identity seam; the front door = RFC 1929 + the credential→identity static mapping.
- Two grants, clean separation (ADR-006):
socks5:open(egress) andsocks5:bind(ingress listeners) — never implied by each other; target policy = the dialer. - Backpressure and limits are inherited, not redefined (the alkcall channels invariants); the one-channel-per-session convention holds for all three commands; the proxy-workload cap posture is ADR-010 (config, not wire).
- Wasm-clean default crate (ADR-009): the default crate is
protocol-only; the vendored subset rides the default-on
netgate (ADR-011);localis opt-in and non-wasm;composedrides alktunnels' wasm-clean default (verified with the wasm check at implementation). - The vendor is first-class (ADR-011): the
T-generic subset in-tree with the four carried changes;/workspace/fast-socks5stays the differential-testing reference; nothing waits on upstream.
Document Lifecycle
| Status | Meaning | Transitions |
|---|---|---|
draft |
Under active development; may change significantly | → reviewed when the doc's open questions resolve |
reviewed |
Architecture is final; implementation may begin | → stable when implementation is complete and verified |
stable |
Locked; changes require review, may warrant an ADR | → deprecated when superseded |
deprecated |
Superseded; kept for reference | Removed when no longer referenced |
References
- Phase 0:
docs/research/phase-0.md(the OQ ledger + convergence), the POC findings files,docs/research/iroh-socks5-eval.md - The SDD process:
docs/sdd_process.md(Phase 1's process; the task format; the deferred-OQ blocker-task half) - Upstream: alkcall ADR-037/039/047/049/050/040/041/051, ledger CF-005/CF-006; alktunnels ADR-003/004/006/007/008 + the graduation research; alknet ADR-078/090
- Siblings: alktty (
/workspace/@alkdev/alktty), alktunnels (/workspace/@alkdev/alktunnels) - Reference checkout:
/workspace/fast-socks5(v1.0.0, MIT, third-party — the differential-testing reference) - RFC 1928, RFC 1929; tun2proxy (
/workspace/tun2proxy)