Hojun-Cho 65104ade92 httpdl: fix progress-reporter race on name/out; harden mirror & resume validation
Findings from a Rob-Pike-lens review (bugs/races/network), each verified
against the code before fixing:

- httpdl: name/out are now atomic.Pointer[string] -- the engine publishes a
  download to the reporter before Run resolves the name, so Stat raced the
  write (bt already did this)
- httpdl: a malformed --proxy fails loudly instead of silently bypassing it
- httpdl: a 206 must carry a matching Content-Range; a 200 in segmented mode is
  fatal so it fails over instead of burning the retry budget
- httpdl: single-stream mirror failover validates the range before appending;
  ErrTooSlow only when the error is a real ctx cancellation
- httpdl: idle guard tracks progress by timestamp (no Reset/Stop race, no
  sticky fired flag)
- httpdl/control: reject a resume file whose segments don't tile [0,total)
- bt: clamp the listen-port range; verify on-disk data before choosing pieces
  under --check-integrity
- cli: reject size overflow; show --seed-time=MIN; clamp --select-file range
- progress/engine/main: clamp ETA against int64 overflow; show queued
  downloads as waiting; join the reporter on exit instead of a 20ms sleep
2026-06-20 23:28:26 +09:00
2026-06-19 12:32:14 +09:00

got

A command-line download tool in Go. It fetches HTTP(S) files over multiple connections and downloads BitTorrent magnets and .torrent files — one binary, familiar flags.

Build

go build -o got .

Needs Go 1.25+.

Usage

# HTTP download with 16 connections
got -x16 -s16 https://example.com/big.iso

# let got pick the connection count from the file size
got --auto-split https://example.com/big.iso

# resume an interrupted download
got -c https://example.com/big.iso

# one file from several mirrors (connections spread across servers,
# a dead mirror falls over); -Z downloads them as separate files instead
got -x4 https://a.example/big.iso https://b.example/big.iso

# a torrent or magnet; seed for 30 minutes after finishing
got --seed-time=30 ubuntu.torrent
got 'magnet:?xt=urn:btih:...'

# many downloads, two at a time
got -j2 -i urls.txt

Run got --help (or --help=all) for every option.

Common options

flag meaning default
-d, --dir output directory .
-o, --out output filename from URL
-c, --continue resume a partial download false
-x, --max-connection-per-server connections to one server (116) 1
-s, --split split a download into N connections 5
--auto-split choose connections from file size (overrides -x/-s) false
-j, --max-concurrent-downloads downloads at once 5
--max-overall-download-limit global speed cap 0 (off)
--checksum verify the finished file: TYPE=DIGEST (sha-256, sha-1, …)
--seed-time minutes to seed after a torrent finishes by ratio
--seed-ratio stop seeding at this ratio 1.0
-S, --show-files list torrent files and exit
-q, --quiet no progress output false

Resume

HTTP downloads resume from a small <file>.got sidecar — just re-run with -c. Torrents resume from the data already on disk. To resume across runs, point --save-session and -i at the same file:

got -c --save-session=got.session -i got.session  <urls/magnets...>

Notes

  • BitTorrent uses anacrolix/torrent; HTTP uses the standard library.
  • Not implemented: FTP/SFTP, Metalink, and the JSON-RPC server.
  • When several torrents run at once, --max-download-limit / --max-upload-limit apply per run rather than per torrent (--max-overall-* are exact).
Description
No description provided
Readme 591 KiB
Languages
Go 100%