跳到主内容
@wquguru
精选88GitHub 新爆发仓库(GitHub)技巧与观点

Rust重写Telegram工具tdl-next发布,性能大幅超越Go版

beautifulrem/tdl-next: A fast, resumable Telegram downloader, uploader and exporter, written in Rust. Command-line tool and full-screen TUI.

原文
发到 X
推荐理由

Telegram重度用户和开发者必看,Rust重写后性能提升数倍且内存更优,提供了完整的迁移指南和详细基准数据,值得收藏替换旧工具。

A fast, resumable Telegram downloader, uploader and exporter, written in Rust. Command-line tool and full-screen TUI.

一款快速、可恢复的 Telegram 下载器、上传器和导出工具,使用 Rust 编写。提供命令行工具和全屏 TUI。

GitHub repository created 2026-11-26 · 1041 stars in 3.5 days (about 294 a day) · Rust

GitHub 仓库创建于 2026-11-26 · 3.5 天内获得 1041 颗星(约每天 294 颗)· Rust

tdl-next Fast, resumable Telegram media transfers, chat exports, and streaming in Rust.

tdl-next 使用 Rust 实现快速、可恢复的 Telegram 媒体传输、聊天导出和流媒体功能。

English · 简体中文 · Docs · Changelog

tdl-next ships the **`tdln`** CLI for downloading, uploading, forwarding, streaming, and exporting Telegram media from your terminal. It is a clean-room Rust rewrite inspired by iyear/tdl and coexists side by side with legacy `tdl` using isolated paths (`~/.tdl-next`) and `TDLN_*` environment variables.

tdl-next 提供了 **`tdln`** CLI,用于从终端下载、上传、转发、流式传输和导出 Telegram 媒体。它是受 iyear/tdl 启发的 Rust 独立重写版本,与旧版 `tdl` 并存,使用隔离的路径(`~/.tdl-next`)和 `TDLN_*` 环境变量。

Features

功能特性

  • Parallel multi-DC transfers — Dedicated media connections per data center with adaptive rate-limit control. - Crash-safe resume — Chunk-level progress in SQLite WAL resumes interrupted downloads without re-fetching completed blocks. - CLI, JSON, and fullscreen TUI — Script with `--json` / `--jsonl` and fixed exit codes, watch inline progress, or run `tdln tui`. - Authenticated HTTP streaming — `tdln dl --serve` streams allowlisted media over `127.0.0.1` with byte-range seeking for `mpv` or VLC. - Native filters and safe templates — Filter by extension, MIME prefix, and size; route to forum `--topic`s; format safe output filenames. - Hardened secret storage — Keeps auth keys in the OS keychain or an `Argon2id` + `ChaCha20-Poly1305` vault (`vault.enc`), never in SQLite.
  • 并行多 DC 传输 — 每个数据中心专用媒体连接,并具备自适应速率限制控制。 - 崩溃安全恢复 — SQLite WAL 中的分块级进度可在不重新获取已完成块的情况下恢复中断的下载。 - CLI、JSON 和全屏 TUI — 使用 `--json` / `--jsonl` 和固定退出代码进行脚本编写,查看内联进度,或运行 `tdln tui`。 - 认证 HTTP 流媒体 — `tdln dl --serve` 允许通过 `127.0.0.1` 对白名单媒体进行流式传输,支持 `mpv` 或 VLC 的字节流寻址。 - 原生过滤器和安全模板 — 按扩展名、MIME 前缀和大小进行过滤;路由到论坛 `--topic`;格式化安全的输出文件名。 - 强化的密钥存储 — 将认证密钥保存在操作系统密钥链或 `Argon2id` + `ChaCha20-Poly1305` 保险库(`vault.enc`)中,绝不存储在 SQLite 中。

Installation

安装

macOS and Linux (verifies SHA-256 against `tdln_checksums.txt`; no root required):

macOS 和 Linux(针对 `tdln_checksums.txt` 验证 SHA-256;无需 root 权限):

Windows (PowerShell):

Windows(PowerShell):

npm, pnpm, or bun (installs `tdln` and `tdl-next` prebuilt binaries; or run `npx tdl-next`):

npm、pnpm 或 bun(安装 `tdln` 和 `tdl-next` 预编译二进制文件;或运行 `npx tdl-next`):

Cargo (Rust 1.96+; pass `--no-default-features` for minimal headless builds without `tui`/`serve`):

Cargo(Rust 1.96+;对于不包含 `tui`/`serve` 的最小化无头构建,请传递 `--no-default-features`):

Docker:

Docker:

Prebuilt archives, provenance verification, proxies, and shell completions are covered in docs/installation.md.

预编译归档包、来源验证、代理和 Shell 补全详见 docs/installation.md。

Quick start

快速开始

Pass `-n ` to isolate multiple accounts and run `tdln doctor` to verify connectivity and storage. See the Quickstart and CLI Reference for all commands and flags.

传入 `-n ` 以隔离多个账户,并运行 `tdln doctor` 以验证连通性和存储。有关所有命令和标志,请参阅快速入门和 CLI 参考。

Performance

性能

Loopback benchmarks on Apple M4 with byte-exact SHA-256 verification (see docs/benchmarks.md for methodology):

Apple M4 上的回环基准测试,带有字节精确的 SHA-256 验证(方法论见 docs/benchmarks.md):

Workload`tdln` (Rust)Legacy Go `tdl`Peak RSS (`tdln`)
50 × 64 KiB small-file batch309.5 ms5,057.7 ms13.9 MiB
100 MiB multi-connection download89.0 ms247.1 ms120.0 MiB
200 state/progress writes26.2 ms1,636.1 ms10.4 MiB
4 GiB streaming download (8,192 chunks)3,056.2 ms (1.34 GiB/s)—23.5 MiB
CLI cold `--help` startup (`hyperfine`)4.6–12.0 ms19.7–34.6 ms8.9 MiB
工作负载`tdln` (Rust)旧版 Go `tdl`峰值 RSS (`tdln`)
50 × 64 KiB 小文件批量处理309.5 ms5,057.7 ms13.9 MiB
100 MiB 多连接下载89.0 ms247.1 ms120.0 MiB
200 次状态/进度写入26.2 ms1,636.1 ms10.4 MiB
4 GiB 流式下载(8,192 个块)3,056.2 ms (1.34 GiB/s)—23.5 MiB
CLI 冷启动 `--help` (`hyperfine`)4.6–12.0 ms19.7–34.6 ms8.9 MiB

Coming from Go `tdl`

源自 Go `tdl`

`tdln` installs alongside `tdl` without touching `~/.tdl`, `TDL_*` variables, or `_tdl` shell completions. Onboard accounts with `tdln login -T desktop|qr|code`, and use `tdln backup` / `tdln recover` (`.backup.tdln` / `.backup.tdln.enc`) for portable snapshots. Flag mappings and intentional security differences are documented in docs/migration.md; the historical Go source is archived on the `Go` branch.

`tdln` 可与 `tdl` 共存安装,不会触碰 `~/.tdl`、`TDL_*` 环境变量或 `_tdl` shell 补全。使用 `tdln login -T desktop|qr|code` 登录账户,并通过 `tdln backup` / `tdln recover`(`.backup.tdln` / `.backup.tdln.enc`)进行便携式快照备份。标志映射及有意为之的安全差异详见 docs/migration.md;历史 Go 源码已归档于 `Go` 分支。

Documentation

文档

  • Getting started: Installation · Quickstart · Migrating from Go `tdl` - Reference: CLI Reference · Fullscreen TUI · Filtering & Templates - Engineering: Architecture · ADR 0001 · Security Design · Benchmarks · Testing · Releasing
  • 入门:安装 · 快速开始 · 从 Go `tdl` 迁移 - 参考:CLI 参考 · 全屏 TUI · 过滤与模板 - 工程:架构 · ADR 0001 · 安全设计 · 基准测试 · 测试 · 发布

Contributing & Security

贡献与安全

Read CONTRIBUTING.md before opening a pull request. Report vulnerabilities privately via SECURITY.md.

在提交拉取请求前请阅读 CONTRIBUTING.md。请通过 SECURITY.md 私下报告漏洞。

Acknowledgements & License

致谢与许可证

Inspired by iyear/tdl and built with grammers and ratatui (NOTICE). Licensed under AGPL-3.0-only.

灵感源自 iyear/tdl,基于 grammers 和 ratatui 构建(见 NOTICE)。采用 AGPL-3.0-only 许可证。

更进一步:量化金融体系

看懂新闻只是起点——沿量化金融路径,把它变成能交付的工程能力

进入量化体系 →

相似阅读

关联信息,但可能不是同一事件