System Architecture & Design

Understanding how gftp achieves high-speed differential uploads on Windows.

Module Overview

1. Windows WinINet Subsystem

Wraps wininet.dll (InternetOpenA, InternetConnectA, FtpOpenFileA, InternetWriteFile). Provides streaming byte chunks with callback notifications for progress bars.

2. Git Engine & SHA State Tracker

Interfaces with git diff --name-status <SHA> and stores the last deployed commit SHA remotely in .gftp_state on the FTP server.

3. Ignore Rules Engine

Implements wildcard pattern matching (*, ?, /) to parse .gitignore and .gftpignore, preventing transfer of temporary files and node modules.

4. Credential Obfuscation

Default target credentials in C++ source are encoded using byte-array XOR obfuscation keying (0x5A) so passwords are never stored in plain-text strings inside binaries.

Synchronization Workflow Diagram

+-----------------------+        +-----------------------+        +-----------------------+
|  Local Working Tree   | ------> |  Git Engine (HEAD SHA)| ------> |  Fetch Remote SHA     |
|  (Modified files)     |        |  git diff  HEAD   |        |  (.gftp_state on FTP) |
+-----------------------+        +-----------------------+        +-----------------------+
                                             |
                                             v
                                  +--------------------+
                                  | Ignore Filter      |
                                  | (.gitignore rules) |
                                  +--------------------+
                                             |
                                             v
                                  +--------------------+
                                  | WinINet FTP Sync   |
                                  | Live Progress Bar  |
                                  +--------------------+
                                             |
                                             v
                                  +--------------------+
                                  | Update Remote SHA  |
                                  | (.gftp_state SHA)  |
                                  +--------------------+