1.7 KiB
1.7 KiB
proton-backup
A Go CLI tool for backing up local directories to Proton Drive with rate limiting, retry logic, and resume support.
Build
go build
Install
cp proton-backup ~/bin/
Run
proton-backup -source /path/to/backup -remote /proton/drive/path
Project Structure
main.go- Single-file implementation containing:- CLI argument parsing
- Proton Drive authentication (username/password or env vars)
- Credential caching (
~/.config/proton-backup/credentials.json) - Directory walking and file upload
- SQLite state tracking for resume (
~/.config/proton-backup/state.db) - Rate limiting and exponential backoff on errors
Dependencies
github.com/henrybear327/Proton-API-Bridge- Proton Drive API with client-side encryptiongithub.com/mattn/go-sqlite3- State trackinggolang.org/x/term- Secure password input
Key Configuration
The AppVersion header is required by Proton's API. Current value: web-drive@5.2.0 (from Proton WebClients repo). If authentication fails with "Invalid app version", check https://github.com/ProtonMail/WebClients/blob/main/applications/drive/package.json for the current version.
Authentication
First run prompts for credentials interactively. Alternatively, set environment variables:
PROTON_USERNAMEPROTON_PASSWORD
Systemd Integration
Timer and service files are in ~/.config/systemd/user/:
backup-immich-proton.servicebackup-immich-proton.timer
Testing
No automated tests yet. Manual testing:
# Dry run (still requires auth)
proton-backup -source /tank/immich/library -remote /backups/immich -dry-run
# Verbose output
proton-backup -source /tank/immich/library -remote /backups/immich -verbose