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
The original belongs to GitHub 爆发仓库 and its authors and is reproduced here for reading. To have it removed, write to support@aisa.one.