Croc: A CLI Tool for Secure, Full-Duplex File Transfers
Better Stackgo watch the original →
the gist
Croc is a Go-based CLI tool that enables fast, secure, and simple file transfers between machines by using a full-duplex relay and PAKE-based encryption, bypassing the need for port forwarding or static passwords.
Architecture and Performance
Croc optimizes file transfer speeds by implementing a full-duplex relay model. Unlike standard tools that require a sequential upload-then-download process, croc allows both machines to send and receive data simultaneously. If both devices are on the same local network, the tool automatically detects the proximity and performs the transfer locally to maximize throughput. The system is designed to be NAT-traversal friendly, allowing it to function through firewalls without requiring manual port forwarding or server configuration.
Security and Self-Hosting
Security is handled via Password Authenticated Key Exchange (PAKE). Instead of relying on a static shared password, the sender and receiver use a disposable code phrase to perform a cryptographic exchange that generates a strong, ephemeral encryption key. This ensures that even if a relay server is used, the relay only processes encrypted bytes and cannot access the file contents. For organizations with strict data residency requirements, users can self-host their own relay server using the built-in croc relay command, which is also available as a Docker image.
Usage and Resilience
Croc operates as a single binary with a minimal command-line interface. To send a file, the user runs croc send [filename], which generates a code phrase. The receiver enters croc [code-phrase] to initiate the transfer. The tool includes built-in support for resuming interrupted transfers, allowing users to pick up where they left off if a connection drops mid-transfer.