Files
TTDownloader/third_party
tongtong eb3df9aa3d Add FTP and magnet backends, tracker and proxy settings, and organize client modules
Integrate pinned libcurl, libtorrent and static OpenSSL dependencies with license notices. Enable verified HTTPS trackers and authenticated HTTP/SOCKS5 proxies, add tracker TXT import without arbitrary list caps, and allow resizing the main window.

Organize client sources by responsibility and update Visual Studio projects, filters and tests. Debug and Release builds passed, along with UI, HTTP, tracker import and browser bridge regressions. Full protocol tests have an unresolved intermittent HTTPS tracker wait timeout; Windows 7 runtime validation remains outstanding.
2026-11-27 11:28:30 +08:00
..

Protocol dependencies

Run prepare.ps1 -Configuration Release (or Debug). Requires CMake, MSVC v143 and Strawberry Perl. build.cmd and test.cmd invoke this automatically. First build downloads pinned official source archives, verifies SHA-256, and builds static libraries. Sources and artifacts are ignored by Git; the bootstrap script, hashes, CMake configuration and license notices are versioned.

  • libcurl 8.23.0: FTP/FTPS and proxied HTTP/HTTPS in the application router, Schannel TLS, static CRT; curl license.
  • libtorrent-rasterbar 2.0.11: BitTorrent v1/v2 magnet, metadata, DHT and resume; BSD license plus bundled notices. Boost 1.86.0 supplies headers (Boost Software License).
  • All builds define Windows 7 (_WIN32_WINNT=0x0601). The wrapper removes libtorrent's upstream CMake Windows 10 target definition without editing upstream sources. Runtime Windows 7 SP1 testing is still required before a compatibility release.
  • OpenSSL 3.5.9 LTS (Apache-2.0) is built statically without assembly or loadable modules. libtorrent HTTPS trackers validate certificates against Windows ROOT. FTPS and proxied HTTPS use Schannel.
  • Ship NOTICES.txt with application binaries.

FTP supports passive binary transfers and REST resume, with restart on rejected resume. Credentials in FTP URLs are stored with the task URL in tasks.db; use anonymous URLs for tasks that must not persist credentials. Direct HTTP/HTTPS use WinHTTP; configured proxies use libcurl.

Magnet tasks use dedicated BT- directories to isolate multi-file storage. libtorrent manages files and verification, while the engine owns task scheduling, throttled UI/SQLite updates and pause commands. Metadata and periodic resume snapshots are kept under LocalAppData/TTDownloader/resume/.resume. Tasks retain the existing single-active-task scheduler. Finishing a torrent stops the session; background seeding is not enabled. Deleting a magnet task retains downloaded files and resume data, and the dialog states that behavior.

Protocol regression tests bind only 127.0.0.1, disable DHT/LSD/UPnP/NAT-PMP in test sessions and create temporary storage. They test a local FTP server and real magnet metadata/payload exchange with a local seeder. Browser auto capture remains restricted to observed HTTP/HTTPS GET; FTP/magnet are added through the desktop client or command line.

Tracker configuration

Settings -> Tracker opens a native multiline editor. User settings are stored under HKCU/Software/TTDownloader/Trackers. UDP, HTTP and HTTPS URLs are validated and deduplicated. Saving applies through an engine command to the active magnet transfer and to queued/restored tasks. The original magnet trackers remain; saved global trackers are discarded when loading resume data and replaced with current settings.

Default tracker seed list: https://github.com/ngosang/trackerslist (three UDP entries selected from trackers_best.txt on 2026-11-21). These addresses do not guarantee availability or peers for a particular hash. DHT uses the bootstrap endpoints documented by libtorrent at https://www.libtorrent.org/reference-Settings.html. Metadata status reports connected peers, DHT routing nodes, tracker count and tracker errors.

Proxy configuration

Settings -> Proxy supports direct, HTTP and SOCKS5 with optional credentials, encrypted with current-user DPAPI. HTTP proxies cannot carry UDP Tracker/DHT. SOCKS5 resolves hostnames remotely; UDP requires server support. Saving rebuilds active magnet sessions; existing HTTP/FTP streams require pause/resume. Failures do not fall back to direct. Tests use authenticated loopback proxies and reject self-signed HTTPS certificates without changing system trust.