Files
got/README.md
Hojun-Cho 81c44d9ec7 httpdl/cli: drop --auto-split; classify errors by type, not message text
Two Pike cleanups.

--auto-split was a got-only third connection-count policy (beside -x and -s)
that invented rather than matched aria2. Removing it also retires the now-dead
autoConns/maxAutoConns and the per-host transport cap that existed only to scale
for it; min(split, M*-x) is the sole policy again.

main's exit-code mapping fell back to substring-matching third-party error text
(strings.Contains "connection refused"/"timeout"/...), which rots when a
dependency rewords a message. The typed checks (errors.Is on the syscall errno,
*net.DNSError, net.Error.Timeout, context.DeadlineExceeded) already cover the
real stdlib errors -- verified end to end: refused -> 6, bad host -> 19. The two
cases that genuinely needed the text match are our own errors, now typed
sentinels: httpdl.ErrTimeout (idle timeout) and the bt metadata timeout wrapping
context.DeadlineExceeded.
2026-06-20 23:55:39 +09:00

73 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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
```sh
go build -o got .
```
Needs Go 1.25+.
## Usage
```sh
# HTTP download with 16 connections
got -x16 -s16 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 |
| `-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:
```sh
got -c --save-session=got.session -i got.session <urls/magnets...>
```
## Notes
- BitTorrent uses [`anacrolix/torrent`](https://github.com/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).