Now the hub is WAN-reachable, the transfer path needed real hardening:
- ⏱️ request timeout fix: replaced the 30s TOTAL http.Client.Timeout (which
killed a 256MiB blob mid-transfer over a slow link) with granular dial / TLS /
response-header timeouts + TCP keepalive. Body transfer is no longer wall-clocked.
- 🔁 retry + exponential backoff on transient blob transfers (network / 5xx),
3 attempts; 4xx fails fast. Blob GET/PUT are content-addressed (idempotent),
so retry is safe; control calls are left alone.
- 🚀 parallel blob uploads (push) and parallel chunk downloads (pull reassembly),
bounded pools (8), sharing the existing rate limiter. WAN is RTT-bound — this
keeps the pipe full instead of one-blob-at-a-time.
- 🗜️ download (response) gzip: round 1 compressed only uploads, but a clone is
download-heavy. Client negotiates gzip explicitly (so the rate limiter counts
wire bytes), hub streams the response through gzip, client decompresses
bomb-safely. Gated by the same settings.transfer.compress flag.
Tests: retry transient-then-success + 4xx-no-retry, gzip download round-trip.
All existing push/pull round-trips green under -race (refactors behavior-preserving).
The "changed my mind" feature: deferred as YAGNI on a LAN, but the hub is now
WAN-reachable (port-forwarded), so over-the-internet sync is a real path and
compression earns its keep.
- client (settings.transfer.compress, default off): gzip a blob upload only
when it actually shrinks — incompressible chunks (media, encrypted) go raw so
we never inflate the wire. Sets Content-Encoding: gzip. Wired into the daemon
sync loop and the initial `publish` upload.
- hub: decompresses gzip uploads before hashing, so dedup + content-address
integrity are unchanged. Bomb-safe — caps BOTH the compressed stream
(MaxBytesReader) and the decompressed size (LimitReader), rejecting a gzip
header over a non-gzip body.
Tests: client gzip-when-smaller / raw-when-not, hub decompress round-trip +
bad-gzip rejection. go test ./... -race clean, go vet clean.
- LICENSE: MIT (enables the adoption push; public repo was all-rights-reserved).
- go.mod + all imports: git.shoemoney.ai/shoemoney/devbox -> github.com/shoemoney/devbox,
so outsiders can 'go install github.com/shoemoney/devbox/cmd/devbox@latest'. Forgejo
stays the self-hosted home; the registry (devbox-hub) + public dist (devbox-dist) are
unchanged. vet + build + go test -race all green after the rename.
- README: document the go install path.
Security: full git-history scan (manual blob sweep + gitleaks, 84 commits) found
ZERO secrets — Forgejo token never committed, no keys/passwords/private keys.
The device id is derived from the pubkey in JoinRequest, but the hub never
checked the joiner actually held that key — anyone with a token could enroll
claiming another device's identity. Now the client signs JoinChallenge(token,
pubkey) with its ed25519 private key and the hub verifies it (ed25519.Verify)
BEFORE redeeming the token — so a bad request can't burn a legitimate one-time
token either. proto gains a Signature field + the shared JoinChallenge helper.
Regression test: garbage/missing/wrong-key sigs all 401, token survives, valid
join enrolls.