Architecture¶
+------------------------------------------+
browser --------> | api REST + WebSocket + embedded UI |
CnL button -----> | cnl 127.0.0.1:9666 |
dropped file ---> | watch link lists, .torrent, .nzb |
+--------------------+---------------------+
|
+----------v----------+
| app | tasks, scheduler,
| | packages, retries
+----------+----------+
|
+--------------+-----------+-----------+--------------+
| | | | |
+-----v-----+ +-----v-----+ +---v----+ +----v-----+ +-----v-----+
| crawler | | resolver | | engine | | extract | | checksum |
| page -> | | direct | | Gopeed | | zip rar | | sfv md5 |
| files | | debrid | | + rate | | 7z tar | | sha crc |
| | | torrent | | limit | | gz xz | | |
| | | yt-dlp | | proxy | | bz2 zst | | |
| | | headless | | | | | | |
| | | JD | | | | | | |
+-----------+ +-----------+ +--------+ +----------+ +-----------+
Every link goes to a resolver, which decides how it is fetched: a debrid service such as TorBox, a hoster account, the torrent client, yt-dlp, your own FTP, SFTP or WebDAV server, MEGA, 1fichier, ddownload, KatFile, Clicknupload, FileSpace, Uploadrar, Send.now (the last six on one XFileSharing client), Pixeldrain, Gofile, Mediafire, Krakenfiles, Workupload, Google Drive, Dropbox, OneDrive and SharePoint, WeTransfer, SwissTransfer, Rapidgator, Keep2Share, FileBoom, TezFiles, Nitroflare and filer.net on your premium login, the direct path, or the headless JDownloader as the catch-all. When more than one service can take the same link, the order on the Accounts page decides; that includes a magnet link, which a debrid service that takes torrents can fetch in place of the torrent client. JDownloader, yt-dlp and the direct download always come last, because which of them fits depends on the link.
A login KnightLoader signs in with itself is kept from JDownloader, so the
hoster sees one sign-in. When KnightLoader's own client cannot use it, the
login goes back to JDownloader and the hoster's links follow it there, until a
check with KnightLoader's client works again (internal/ownlogin). Without a
login, the free downloads of Rapidgator, the Keep2Share family and filer.net
go through the same package: the captcha is asked through the phone app and
the captcha accounts, and the countdown and the pause between free downloads
run on the same wait loop as every other hoster wait.
The rate limit lives in a loopback proxy because the embedded engine offers no hook for one. Everything else is a plain Go package with its own tests.
Built on Gopeed (download engine), yt-dlp (media), JDownloader (hoster catch-all, via its local API), Wails (desktop) and React with Tailwind.