Commit Graph

3445 Commits

Author SHA1 Message Date
whr819987540 f7e8a6ad2d add comment for DownloadAll 2023-04-25 19:35:26 +08:00
whr 1fb2348a0e move cmd dir to new repo, torrent_main.git 2023-04-25 11:24:58 +08:00
whr 570704dcff add comment 2023-04-25 00:06:09 +08:00
whr 5f9483f571 add comment 2023-04-25 00:05:16 +08:00
whr 0a8b545d28 add comment and todo 2023-04-25 00:04:38 +08:00
whr 6f42096625 add go.mod for cmd/torrent 2023-04-24 21:34:30 +08:00
whr fd2f475ed0 go mod edit -replace=github.com/anacrolix/torrent=../torrent 2023-04-24 21:30:23 +08:00
Matt Joiner fdb0911e28
Don't log using torrent source as warning for context cancellation
This probably occurs because the info was obtained and we don't need to try the source anymore.
2023-04-04 19:13:14 +10:00
Matt Joiner 42d29d95a6
Import generics as g 2023-04-04 19:12:26 +10:00
Matt Joiner 069b92a98c
Add AddTorrentOpts.InfoBytes 2023-04-04 19:12:01 +10:00
Matt Joiner 8d3e86e3c0
Expose StringAddr 2023-04-03 15:10:54 +10:00
Matt Joiner e13fd755ee
bencode: Only use unsafe.String for go>=1.20 2023-04-03 15:10:38 +10:00
Matt Joiner 872b11bd57
bencode: Support parsing strings into bool 2023-03-20 10:50:22 +11:00
Matt Joiner c069849b40
Add Peer.Torrent
This was for accessing from callback events.
2023-03-01 14:17:29 +11:00
Matt Joiner 31bbd435f9
gorond 2023-03-01 12:34:35 +11:00
Matt Joiner d3b3d2d9bf
Finish moving all Peer types and methods into peer.go 2023-03-01 12:34:16 +11:00
Matt Joiner 2ae264b6cc
Expose UDP tracker error response type 2023-02-24 16:20:08 +11:00
Matt Joiner 63982c3c80
Don't reconnect before sending requests with current conn ID
The tracker udp://tracker.torrent.eu.org:451/announce gives `error response: "Connection ID missmatch.\x00"` every 2 minutes when under heavy use. I suspect that reconnect requests are sent just after the connection ID is confirmed as not stale, but before it used for a request, and the server rejects the request after processing the reconnect first.

It might also just be that that tracker server implementation is lazy and marks everything stale on regular boundaries.
2023-02-20 15:49:55 +11:00
Matt Joiner e8971ea0f1
Add unit test for relative availability after HaveNone
Could help with https://github.com/anacrolix/torrent/issues/813.
2023-02-19 13:24:25 +11:00
Matt Joiner 48b3e66c76
Add http and udp tracker server implementations 2023-02-19 12:08:23 +11:00
Matt Joiner e8b04c7181
gofumpt 2023-02-18 18:35:22 +11:00
dependabot[bot] 81201050bc
Bump golang.org/x/net from 0.5.0 to 0.7.0 (#819)
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.5.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.5.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-18 16:06:17 +11:00
Matt Joiner 2cb7121a93
Limit peer request data allocation
This follows up from abb5cbc96e. We currently limit how many requests peers can send us, but didn't really check that peers didn't make us allocate huge amounts of space to buffer their requests. I'm sure there's some rough edges here.
2023-02-14 12:46:49 +11:00
dependabot[bot] ceb7b2443a
Bump github.com/pion/dtls/v2 from 2.1.5 to 2.2.4 (#814)
Bumps [github.com/pion/dtls/v2](https://github.com/pion/dtls) from 2.1.5 to 2.2.4.
- [Release notes](https://github.com/pion/dtls/releases)
- [Commits](https://github.com/pion/dtls/compare/v2.1.5...v2.2.4)

---
updated-dependencies:
- dependency-name: github.com/pion/dtls/v2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-14 08:15:15 +11:00
Matt Joiner abb5cbc96e
Check for chunks overflowing piece bounds on request read
Test for integer overflow in when checking read requests are within the bounds of the associated piece. Another fix is required to limit the amount of memory that can be allocated for such requests.
2023-02-13 23:27:15 +11:00
Colin Marc 60fd7581e7
Remove unecessary completion "set" (#812)
If the file has never been downloaded, complete will naturally be false. It's
not necessary to then set it false again unless it was actually claimed to be
true in the first place.

In my tests, using the boltdb completion thingy with fsync turned *on*, this
reduced the cold start for big buck bunny from multiple seconds to just a few
ms.
2023-02-13 14:26:03 +11:00
Spencer Comfort 5a185c45c0
Update codeql analysis to v2 (#806)
Updates the outdated codeql analysis actions to v2
2023-01-31 08:41:06 +11:00
Matt Joiner d47739db0c
Roaring bitmap tests now pass when run from downstream 2023-01-24 08:52:49 +11:00
Matt Joiner 8fe9fb78aa
Add span for udp packet handling 2023-01-08 17:22:02 +11:00
Matt Joiner 1eb923c947
Forward leechers and seeders announce handler results 2023-01-05 00:05:34 +11:00
Matt Joiner 2dfb57f3f7
Handle left param for http tracker server announces 2023-01-05 00:04:42 +11:00
Matt Joiner c20f73d53e
gorond 2023-01-04 01:26:31 +11:00
Matt Joiner a512c0df61
Add a check that piece request order items are scanned in order
It's not clear from btree documentation that scan should be ordered.
2023-01-04 01:25:57 +11:00
Matt Joiner 8e0e36887f
Fix an issue parsing negative bencode string lengths
See the fuzz test in dht/krpc.
2023-01-04 01:25:26 +11:00
Matt Joiner 6baf8dcb99
Limit udp tracker server request concurrency 2023-01-03 00:14:21 +11:00
Matt Joiner 8c267645bf
Update tidwall/btree 2022-12-31 13:25:00 +11:00
Matt Joiner 14cf045b6a
Sleep webseed peers after unhandled errors 2022-12-31 11:27:47 +11:00
Matt Joiner f38629d354
Assume upstream peers are leechers 2022-12-29 19:42:19 +11:00
Matt Joiner 4f8826483e
Resize packet buffer to avoid wasting memory 2022-12-29 19:41:36 +11:00
Matt Joiner f61085c785
Avoid panic in AnnounceEvent.String 2022-12-29 19:41:09 +11:00
Matt Joiner 5f127343b0
Fix race when final peers are available early 2022-12-29 19:40:20 +11:00
Matt Joiner 7d3d4bc088
Add Context parameter to SendResponse 2022-12-29 10:22:03 +11:00
Matt Joiner 7f3655a14b
Track request payload len 2022-12-29 10:21:34 +11:00
Matt Joiner 61a303cbf7
Default to announcing as leecher
(cherry picked from commit 16da3c0c46)
2022-12-25 19:57:16 +11:00
Matt Joiner e235776204
Add --port flag to announce
(cherry picked from commit e554aa19a6)
2022-12-25 19:56:55 +11:00
Matt Joiner 87105005e3
Merge branch 'universal-webseed-escaping' 2022-12-25 19:26:01 +11:00
Matt Joiner fed765b2a0
Fix write error handling
Fixes https://github.com/anacrolix/torrent/issues/798.

Prior to this fix, it looks like the writer would just keep writing chunks of the front buffer (incorrectly if there was an error), until presumably the writer would be killed by read hangup elsewhere.
2022-12-25 19:24:16 +11:00
Matt Joiner 079599b91b
Don't use path.Join in default webseed path escaper
Thanks fuzzing!
2022-12-25 18:20:42 +11:00
Matt Joiner df126fcace
Add fuzzing for webseed path escaping 2022-12-25 18:20:23 +11:00
Matt Joiner 291c428016
Change default webseed path escaping to work for all S3-compatible providers 2022-12-23 11:18:36 +11:00