FTS-Tool Banner

FTS-Tool Protocol Overview

What is FTS-Tool?

FTS-Tool is a lightweight CLI tool and TUI application for fast local-network file transfers and communication. It uses its own FTS-Tool protocol based off of tcp! You can check out the project’s GitHub repositories to learn more!

How FTS uses TLS for TCP

FTS first establishes a TCP connection and then performs a TLS handshake. The server uses a self-signed certificate, which the client verifies using a Trust on First Use (TOFU) policy. As with other TOFU systems, the first connection is not protected against a man-in-the-middle attack; once trusted, however, a changed certificate causes the connection to be rejected.

Upon connecting, the server will send its MAC address as a host identifier along with a self-signed certificate. The client hashes the certificate with Python’s hashlib.sha256 function to generate a “fingerprint.” It then compares this fingerprint against the saved fingerprint stored under the server’s entry in known_servers.json.

  • If the fingerprints do not match: The socket is closed, and the user must manually run fts trust <host-identifier> to clear the record.
  • If the server is unknown: The client prompts the user to trust the new certificate (similar to SSH). Once approved, the fingerprint is saved to known_servers.json.

From this point FTS begins communicating over the encrypted connection.

Header

The client then builds a 23-byte header containing:

  • Magic Number
  • Protocol Version
  • Flags
  • UTF-8 Filename Size in Bytes
  • Filesize
  • Header Checksum

After verifying the header and sender, the server responds with:

  • SEND: The server accepts the header and is ready to receive the file.
  • HOLD: The server has received the header but cannot immediately process the transfer. The client waits for the server’s next response.
  • DENY: The server rejects the transfer and closes the connection.

If the client sends the Resume flag, the server responds with the byte offset at which the client should resume transmission.

File Transfer

During the transfer, disk I/O and network I/O are performed concurrently. The client reads file data from disk while sending it over the TLS connection, while the server receives the data and writes it to disk. Once the server receives and successfully writes the full byte payload specified by the filesize header, it sends an OKAY response and terminates the connection.