Implement ADR-092 across the workspace: accept_bi/open_bi return BiStream (a concrete AsyncRead + AsyncWrite + Send + Unpin newtype), not the split (SendStream, RecvStream) pair. The join moves into core's BidiStreamSource impls (quinn/iroh via tokio::io::join, single-stream via boxed AsyncReadWrite); handlers receive the joined BiStream and never see the pair. Core (alknet-core/src/types.rs): - Add concrete BiStream struct boxing Box<dyn AsyncReadWrite + Unpin>, with AsyncRead + AsyncWrite impls. from_joined (pub, for downstream crates that produce split halves naturally — channels reassembly, tests) and from_bidi (pub(crate), for Connection::from_bidi) constructors. - Change BidiStreamSource::accept_bi/open_bi return types from (SendStream, RecvStream) to BiStream. Update QuinnBidiStreamSource, IrohBidiStreamSource, StreamBidiStreamSource impls to do the join once. - Collapse SendStream/RecvStream to thin newtypes over Box<dyn Async* + Send + Unpin>. Remove SendStreamKind/RecvStreamKind enums and the quinn/iroh per-call dispatch (the join happens once in the BidiStreamSource impl now). Keep SendStream::from_stream / RecvStream::from_stream per-half boxing for into_sub_streams() (ADR-074) and the future channels reassembly path. - Remove Connection::from_stream (split-pair constructor). Promote Connection::from_bidi to the only public stream constructor (the rule: the split never crosses a crate boundary as part of a constructor). - Update Connection::accept_bi/open_bi to return BiStream. Update from_source_tests and tests modules to use from_bidi and BiStream; add a SinkEmpty test helper (AsyncRead EOF + AsyncWrite discard) for Connection-level-only test connections. alknet-http (server/adapter.rs): - Drop the 44-line QuicStream wrapper — accept_bi returns BiStream which is already AsyncRead + AsyncWrite. HttpAdapter::handle becomes 4 lines. - Drop the 38-line QuicStreamDuplex test helper — tests use a single tokio::io::duplex whose ends are each AsyncRead + AsyncWrite natively. - Remove unused std::io / std::pin::Pin imports. alknet-tty (adapter.rs): - TtyAdapter::handle splits the BiStream from accept_bi via tokio::io::split for drive_session's separate AsyncWrite/AsyncRead args (the stdlib idiom for TcpStream-style duplex streams). alknet-call (protocol/*, client/*): - Dispatcher::run_loop accept_bi site: take BiStream, pass to handle_stream. - Dispatcher::handle_stream signature: take BiStream, split internally via tokio::io::split (was: take SendStream + RecvStream separately). - CallConnection::call_with_payload / subscribe_with_payload / write_envelope: split the BiStream from open_bi via tokio::io::split at the call site. - write_request / read_stream_until_closed: generic over AsyncWrite/AsyncRead (were: concrete SendStream/RecvStream) — accepts the ReadHalf/WriteHalf from tokio::io::split directly. - Add protocol/test_support.rs with sink_empty_connection() (replaces the 5 duplicated stub_connection() fns that used Connection::from_stream). - Update all test stubs (call_client.rs, protocol/connection.rs, protocol/dispatch.rs, protocol/adapter.rs, client/from_call.rs) to use Connection::from_bidi + the shared sink_empty_connection() helper. - Test handle_stream call sites: build BiStream::from_joined(recv, send) from the existing BufReader<Cursor> + duplex pair. Workspace test status: all 9 crates pass (116 + 307 + 18 + 3 + 17 + 301 + 34 + 61 + 23 + 5 + 6 + 8 + 82 + 4 + 3 + 6 + 12 + 1 = 1007 tests pass). One pre-existing failure remains in alknet-http (adapters::to_mcp::tests::search_returns_access_control_filtered_ops_excluding_subscriptions — handler kind mismatch, unrelated to Phase 6, fails on develop baseline).
Alknet
Status: Pre-alpha — This project is undergoing a major architectural pivot to an ALPN-as-service model. The previous implementation has been archived and a greenfield rebuild is in progress.
A self-hostable networking toolkit built on QUIC+TLS with ALPN-based protocol dispatch. Each protocol handler (SSH, SFTP, Git, HTTP, DNS, messaging, call protocol) registers an ALPN string on a shared endpoint. The ALPN negotiation during the TLS/QUIC handshake routes connections to the correct handler before any application bytes are read.
Core Insight
A service IS an ALPN. One endpoint, one port, many protocols — dispatched by the TLS handshake, not by application-level peeking or separate listeners.
Crates
| Crate | Status | Description |
|---|---|---|
alknet-vault |
stable | Local key vault: BIP39/SLIP-0010/AES-GCM key derivation and encryption |
alknet-core |
planned | ProtocolHandler trait, ALPN router, auth/identity, config |
alknet-ssh |
planned | SSH handler (russh), SOCKS5, port forwarding |
alknet-call |
planned | JSON-RPC call protocol (EventEnvelope framing) |
alknet-fs |
planned | Content-addressed file storage (iroh-blobs backend) |
alknet-sftp |
planned | SFTP handler (russh-sftp protocol core) |
alknet-git |
planned | Git smart protocol handler (gix) |
alknet-http |
planned | HTTP handler (axum, REST API, MCP) |
alknet-dns |
planned | DNS handler (hickory-proto, pkarr) |
alknet-msg |
planned | E2E encrypted messaging, mixnet support |
alknet |
planned | CLI binary (assembles and registers handlers) |
Documentation
- ALPN-as-service architecture — pivot proposal
- Cleanup plan — greenfield transition plan
- SDD process — spec-driven development process
- Research references — iroh, russh, russh-sftp deep dives
Reference implementation (previous architecture) is preserved at /workspace/@alkdev/alknet-main/.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.