AIsaAIsaStudio English 打开 AIsa Studio

开源工具 gdirect:用 Rust 在终端直连 Google Drive 下载上传

原标题:mizorewww/gdirect: Rust Google Drive direct downloader using pinned libaria2

作者发布开源工具 gdirect,可在终端浏览、下载、上传和挂载 Google Drive,用 Rust 编写并固定 libaria2,发布 1 天获得 553 星。其原理是扫描本网络可达的 Google IP 并将 Drive 流量直连该 IP,支持多连接和断点续传,若真实 SNI 连接被重置会以伪造身份(TLS 名 g.cn、Host 头用真实主机)重试;证书始终对内置的 Google GTS 根证书校验。登录和 token 刷新仍需经系统网络访问 oauth2.googleapis.com,Google 被阻断时仍需代理;使用 TUN 模式代理时需将扫描出的 IP 设为 DIRECT 并关闭 fake-ip。提供 macOS 15+、Linux x86_64(glibc 2.35+)和 Windows x86_64 预编译包,可通过安装脚本或 Homebrew 安装,mount 功…

为什么值得看

README 说明了直连 Google IP 的路由原理、证书校验方式和网络配置要求,读者可据此判断是否适用自身环境。

阅读原文 ↗

本页的摘要、推荐理由与解读出自 AIsa Studio 的 AI 风向智能体,原文版权归原作者所有。

原文

GitHub 上的新仓库 mizorewww/gdirect,创建 1 天,已有 553 星(平均每天 553 星)。 Rust Google Drive direct downloader using pinned libaria2 语言:Rust

README:

gdirect

中文 · Changelog

gdirect browses, downloads, uploads and mounts your Google Drive from the terminal. It finds Google IPs that are reachable from your network and sends Drive traffic straight to them, with multi-connection, resumable downloads.

How it works

Traffic Route
Drive API, downloads, uploads (browse, ls, download, upload) A scanned Google IP. The hostname and certificate check stay the same. If connections carrying the real SNI are reset, gdirect automatically retries under a forged identity (g.cn as TLS name, the real host in the Host header) — same idea as Sheas-Cealer — and remembers what worked per IP
Sign-in and token refresh (oauth2.googleapis.com) Your normal system network (DNS, proxy)
mount (rclone) Your normal system network

The first transfer command scans candidate IPs automatically and keeps the fastest working one for 24 hours. login and mount do not scan. Each candidate is probed with the real SNI first, then with the forged identity, so the stored route always reflects what actually connects. Certificates are verified against Google's own GTS roots (embedded in the binary), never against a system CA bundle — a compromised third-party CA cannot impersonate Google for gdirect.

Network requirements:

  • Sign-in and token refresh must reach oauth2.googleapis.com through your system network. If Google is blocked, you still need a proxy or VPN for this.
  • If you use a TUN-mode proxy or VPN (for example Clash/Mihomo TUN), route the scanned Google IPs DIRECT and turn off fake-ip for them. Otherwise gdirect's traffic is captured again and the scan finds nothing. gdirect scan --list shows the IPs.

Install

Prebuilt for macOS 15+ (Apple Silicon / Intel), Linux x86_64 with glibc 2.35+ (Ubuntu 22.04+, Debian 12+, recent Fedora/Arch/openSUSE), and Windows x86_64. Alpine/musl, older glibc and Linux ARM64 need a source build.

macOS / Linux (requires curl):

curl -fsSL https://raw.githubusercontent.com/mizorewww/gdirect/main/scripts/install.sh | bash

Windows PowerShell:

& ([scriptblock]::Create((Invoke-RestMethod 'https://raw.githubusercontent.com/mizorewww/gdirect/main/scripts/install.ps1')))

The installer puts gdirect in ~/.local/bin (Windows: %LOCALAPPDATA%\gdirect\bin) and tells you how to add it to PATH. On Windows, open a new terminal after installing.

To use mount, add --with-mount (PowerShell: -WithMount). This also installs rclone 1.75.2+ and, on Linux, FUSE3 through your package manager (uses sudo). On Windows it installs rclone and WinFsp with winget; WinFsp may ask for administrator approval.

Homebrew (macOS / Linux):

brew tap mizorewww/gdirect https://github.com/mizorewww/gdirect
brew install mizorewww/gdirect/gdirect
brew install rclone   # only for mount; Linux also needs your distro's fuse3 package

Upgrade with brew update && brew upgrade gdirect, or by rerunning the installer.

You can also download a release archive. Certificates are verified against Google's own GTS roots, which are embedded in the binary — no CA bundle file is needed.

One-time Google setup (about 10 minutes)

gdirect does not ship a shared Google client, so you create your own in a Google Cloud project, once. Follow the Google setup guide to download a Desktop app OAuth client JSON, then:

gdirect login --client-secret ~/Downloads/client_secret.json

A browser opens. After you approve, the terminal prints Logged in. The JSON file is not needed again.

Daily use

gdirect                                   # same as gdirect browse
gdirect browse -o ~/Downloads             # download directory (default: ./downloads)
gdirect ls root --json
gdirect download FILE_ID_OR_URL           # saves to ./downloads/
gdirect download FILE_ID -o file.zip
gdirect download DOC_ID --export application/pdf -o doc.pdf
gdirect upload ./file.zip
gdirect upload ./file.zip --parent FOLDER_ID --name backup.zip

browse shows the parent folder, the current folder and a preview side by side, like yazi. Press ? for every key.

Key in browse Action
j/k, ↑/↓ Select
g/G, Home/End First / last item
Ctrl-d/Ctrl-u, PgDn/PgUp Half a page / a page down or up
Enter, l/→ Open folder
h/←, Backspace Parent folder
/ Filter the current folder by name. Enter keeps the filter, Esc clears it
Ctrl-r, F5 Refresh
Space Mark or unmark an item. Marks are kept when you change folders
Ctrl-a Mark everything shown (press again to unmark)
Esc Clear the filter, then the marks, then the clipboard
a Create an empty file; a name ending in / creates a folder
r Rename
y / x Copy / cut the marked items, or the selected one
p Paste into the current folder. Cut items are moved; copied files are duplicated (Drive cannot copy folders)
D, Delete Move the marked items, or the selected one, to the Drive trash (asks first)
u Upload a local file into the current folder
d Queue the marked items, or the selected one. A folder is downloaded with all its subfolders into //. Google Docs/Sheets/Slides are exported as PDF
+/- Connections for the next download (1–16), saved as your default
c Cancel the current download and keep the partial data
R Retry failed or cancelled downloads
X Remove downloads that have not started yet
q Quit
  • Queue: downloads run one at a time. The file list shows each file's state (◦ queued, ↓ downloading, ✓ saved, ✗ failed), and the Downloads panel shows overall progress. Select a failed file to see the full error. Files with the same name in one session are saved a

原文版权归 GitHub 爆发仓库 及原作者所有,本站转载仅供阅读。如需删除,请联系 support@aisa.one。