Commit Graph

116 Commits

Author SHA1 Message Date
Matt Joiner ae2e4bf7e7
Use metainfo.ChoosePieceLength from more locations 2022-07-03 21:47:16 +10:00
Matt Joiner 3c54eadf28
torrent serve: Print magnet link 2022-06-14 18:23:00 +10:00
Matt Joiner dd1ca6f514
Use Info.BestName in a few more places 2022-03-18 09:15:50 +11:00
Matt Joiner ff3b74ad88
Prefer UTF-8 fields when present 2022-03-17 15:07:10 +11:00
Matt Joiner a1072bfee9
Add Info "name.utf-8" field
Comes up frequently with non-English torrents
2022-03-17 14:59:36 +11:00
Eng Zer Jun 841a702e34
test: use `T.TempDir` to create temporary test directory (#718)
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-02 18:26:46 +11:00
Matt Joiner 1bf7019340 Comment that BEP 19 is WebSeeds 2021-11-12 10:45:47 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
afjoseph b33b45baf4 [fuzz] Put +build tags to support go1.16 as well 2021-11-01 11:26:58 +11:00
Matt Joiner 2daad6e564 Update fuzz to use new standard library support 2021-09-29 11:51:03 +10:00
YenForYang c740cde71b
metainfo: Remove reflection dependency for `Piece.Hash()` (#661)
`copy`  will copy exactly `HashSize` bytes here.
2021-09-18 11:35:21 +10:00
YenForYang d957502528
Avoid allocating memory when checking interface (#588)
Not a big deal, but there isn't a need to allocate an object to check that `*Node` satisfies `bencode.Unmarshaler`.
2021-09-11 08:26:43 +10:00
Matt Joiner e417c19a74 Add "no name" handling and storage.NewFileOpts
This came out of testing against Transmission in https://github.com/anacrolix/torrent/discussions/556#discussioncomment-1263670.
2021-09-02 10:22:32 +10:00
Matt Joiner aa3b864426 Fix info name when building from . and .. 2021-09-02 10:22:32 +10:00
Matt Joiner 3b62b0054d Fix go:build directives 2021-07-14 14:35:52 +10:00
Matt Joiner c3c982b621 Fixes for wasm 2021-06-23 17:24:50 +10:00
Matt Joiner 615ac41ae3 Fix DeepSource anti-pattern 2021-03-25 09:56:04 +11:00
Matt Joiner 80cfe96c8b Make tracker order in Metainfo.Magnet deterministic
Should fix test failures in CI.
2021-03-25 09:51:49 +11:00
Matt Joiner a22c1334c6 Include webseed urls in MetaInfo.Magnet output
Fixes #469.
2021-02-24 12:11:47 +11:00
Matt Joiner 35464677ef Improve metainfo.MetaInfo.Magnet interface and add tests 2021-02-24 12:11:47 +11:00
Matt Joiner 434dfdf6e0 Add MarkComplete benchmark for sqlite 2021-01-25 15:54:37 +11:00
Matt Joiner 03b1abafb9 Implement encoding.TextMarshaler to match unmarshaler for metainfo.Hash
Fixes https://github.com/anacrolix/torrent/issues/463
2021-01-22 09:53:53 +11:00
Matt Joiner 1e9d382af9 Reinstate cmd/announce announce subcommand 2021-01-04 13:37:44 +11:00
Matt Joiner 0013035c93 Add deprecated ParseMagnetURI 2020-12-21 10:16:08 +11:00
Aranjedeath 8d27c02962 Update metainfo.go
delete "yoloham" so that is no longer the default comment string on torrents made without a comment specified. Should resolve https://github.com/anacrolix/torrent/issues/342
2020-12-10 10:12:33 +11:00
Matt Joiner 493ee9dfd1 Implement fmt.Formatter for metainfo.Hash
It's so easy to make mistakes by specifying %x when printing these.
2020-11-11 15:31:55 +11:00
Matt Joiner e6da640bb2 Tidy up doc, file names, naming 2020-11-09 10:56:45 +11:00
Matt Joiner 587f28d2fa Add comment to metainfo.MetaInfo.CreationDate 2020-05-13 14:33:26 +10:00
Matt Joiner ccc71463b9 Expose metainfo.GeneratePieces 2020-05-13 14:33:26 +10:00
Yaroslav Kolomiiets b4e10e00a9 add BEP references to documentation of the metadata fields 2020-05-03 14:06:24 +10:00
Matt Joiner 92162295af Clone the AnnounceList out of Torrent.Metainfo
Should fix a race with Torrent.AddTrackers
2020-04-15 17:26:02 +10:00
Matt Joiner 376ff763fe Apply staticcheck 2020-02-20 11:09:57 +11:00
Yates 790ba6af3c use path.utf8 first for some torrent (#350) 2019-12-08 20:35:40 +11:00
Matt Joiner f0843c30d0 Add comments to metainfo.Magnet fields 2019-09-24 16:29:29 +10:00
Matt Joiner 584cdbdc60 metainfo.Magnet.String: Always put xt first again, and with specific encoding 2019-09-24 16:29:17 +10:00
Matt Joiner 81ba0df9ed metainfo: Add Magnet.Params for more open handling
Addresses #310.
2019-09-24 15:52:18 +10:00
Matt Joiner 739fb68095 Update the magnet tests
These must have been very old, the style is appalling.
2019-09-24 15:51:08 +10:00
Matt Joiner cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10:00
Matt Joiner dfcb852487 gofmt simplify 2019-08-19 12:15:54 +10:00
Matt Joiner f16bea62a1 metainfo: Add fuzzing func 2019-08-18 16:51:20 +10:00
Matt Joiner a0d0c64e4f metainfo: Fix test
[]byte(nil) now correctly bencodes to a string
2018-11-27 11:05:32 +11:00
Matt Joiner fc4fab91f5 Switch to goimports import sorting
Used to use sortimports, but it's old, and goimports seems to have an opinion now.
2018-11-02 23:12:01 +11:00
Matt Joiner f5bd377941 Change pieceIndex to peer_protocol.Integer 2018-07-12 09:15:15 +10:00
Matt Joiner d7225aed03 Fix #247 2018-04-13 17:07:19 +10:00
Matt Joiner 1f3eace72f bencode: Add ignore_unmarshal_type_error tag 2018-01-27 14:31:46 +11:00
Matt Joiner 0e32592f78 bencode: Give more descriptive errors when failing to parse dicts 2018-01-25 21:46:50 +11:00
Matt Joiner a0172f7c6e Update error message in metainfo.Info.writeFiles
I think it was ripped out of some other code a long time ago.
2017-12-29 12:18:55 +11:00
Matt Joiner 5ac3e9ae54 Introduce metainfo.HashSize
This will be useful when BitTorrent 2 is implemented, and helps with creating arbitrary Info.Pieces
2017-12-29 12:17:58 +11:00
Matt Joiner 8195e8df7b Improve some doc comments 2017-12-29 12:16:05 +11:00
Matt Joiner da9cbc7cf0 metainfo: Omit empty Metainfo.InfoBytes 2017-11-08 19:57:05 +11:00