A Python implementation of the Transferd wire protocol. It follows the specification in docs/ and interoperates with the reference implementation in crates/.
| Area | Module | How it is checked |
|---|---|---|
| Hybrid identity, node ids, key fingerprints | identity, crypto |
vectors/crypto.json |
| Authenticated handshake (X25519 + ML-KEM-768, Ed25519 + ML-DSA-87) | handshake |
reference vectors, loopback tests, live against interop_peer in both directions |
| Tunnel keys, sealed frames, 4096-wide replay window | tunnel |
reference vectors, live |
| Overlay frames and their bincode bodies | frames, bincode |
vectors/wire.json, every frame kind |
| Session opening: HELLO and HELLO_ACK, version negotiation | session |
live against interop_peer in both directions |
| Stream multiplexer: send and receive sides, flow control, in-order delivery, SACK ranges | mux |
a port of the reference's mux.rs unit tests |
| Stream engine: OPEN, DATA, ACK, WINDOW, CLOSE; SACK and duplicate-ACK losses; RTO resends | streams |
engine rules with an explicit clock, loopback |
| Stream driver: reliable control frames, receipts, the timer, the asyncio read and write loops | stream_session |
loopback over TCP, and live against interop_peer echo (600 KiB each way) |
Invites (tdov2:) |
invite |
reference invites, and invites we make |
| Relay messages, proof of work, payload padding | relay |
vectors/wire.json |
| Relay client: register, keepalive, locate, forward | relay_client |
live against the reference relayd |
| Hole-punch probes and the gateway envelope | punch |
vectors/wire.json |
Not implemented yet: mesh DNS, transferd-cat, and the DHT node. The overlay (transferd/overlay.py) probes every route, keeps a congestion window and retransmission timeout per route, and sends each frame on the cheapest route that has room and is up, charging a route for the backlog it still has to clear. A frame a route refuses goes to the next route, reliable control frames are mirrored on every live route, bulk data is striped across routes by measured throughput, and control frames have their own queue so bulk data never holds them up. The stream engine resends on the RTO it is given and on the loss signals it sees.
Python 3.10 or later.
cd python
pip install -e ".[test]"
pytestThe live interop tests need the reference binaries. Without them they are skipped. Build them from the repository root, then point the tests at them:
cargo build -p transferd-overlay --example interop_peer
cargo build -p relayd --bin relayd
cd python
TRANSFERD_INTEROP_PEER=../target/debug/examples/interop_peer \
TRANSFERD_RELAYD=../target/debug/relayd \
pytestOn Windows the executables end in .exe, and the variables are set with set NAME=value (cmd) or $env:NAME = "value" (PowerShell).
transferd/is the package. Each module corresponds to a part of the specification.tests/holds the vector-driven tests, the loopback handshake tests, and the live interop tests. The vectors are read from../vectors/, which the Rust reference examples generate.
- Values that are
u64on the wire and can exceed 2^53 (attempt ids, nonces, proof-of-work nonces, tunnel counters) are Pythonints and are never converted to floats. - The package depends on
cryptography(X25519, AES-GCM, ML-KEM, ML-DSA, Ed25519) andblake3.