Commit Graph

123 Commits

Author SHA1 Message Date
Matt Joiner 50fcd908ca tracker/udp.ConnClient: Make logging configurable
Should fix https://github.com/anacrolix/torrent/issues/701#issue-1088130173
2021-12-28 12:05:01 +11:00
Preston b831060d6e
fix http tracker arg position (#700)
Co-authored-by: Bot Git <bot@example.com>
2021-12-23 12:34:16 +11:00
Matt Joiner 8764456d23 bencode: Enforce dict key ordering
Fix bencode dict key ordering in HTTP tracker test
2021-12-12 16:56:01 +11:00
Matt Joiner aaec4dbd80 tracker/udp: Panic on read errors if ConnClient not closed
There's nothing exposed to handle this error currently, and if it occurs, it's better not to fail in silence. I'm currently debugging a situation where ConnClients stop working, this would be a condition we'd want to know about.
2021-11-23 08:35:45 +11:00
Matt Joiner 615669ecf8 Improve logging of UDP tracker packet dispatch error 2021-11-23 08:33:29 +11:00
Matt Joiner aae32e2a31 Wrap UDP tracker response error 2021-11-23 08:32:25 +11:00
Matt Joiner 6cb65f4ecf Don't dial in UDP tracking
This could fix an issue where tracker addresses change, but we're already bound to a particular address and so fail to receive any more responses.
It should also make it easier to share UDP sockets between UDP tracker clients, although that's not currently implemented.
2021-11-22 18:11:09 +11:00
Matt Joiner 8555ab7f21 Doc comments 2021-11-22 18:10:47 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner a9cbb644c5
Fix http announce of infohash containing ' ' bytes (#591)
Fixes https://github.com/anacrolix/torrent/issues/534.
2021-09-12 14:11:59 +10:00
Bora M. Alper 16176b762e
Add linter CI (#542)
* Add linter CI

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make gosec CI ignore SHA1 and upload sarif

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Fix formatting of source files

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make go vet ignore unkeyed composite literals and fix other warnings

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Make staticcheck ignore unused methods and fix other warnings

Signed-off-by: Bora M. Alper <bora@boramalper.org>

* Use golangci-lint

Signed-off-by: Bora M. Alper <bora@boramalper.org>
2021-08-16 11:11:31 +10:00
Matt Joiner 83749028ec Trim UDP tracker client read allocations 2021-07-26 10:18:24 +10:00
Matt Joiner 4fb13a1868 Fix race in concurrent connects in UDP tracker 2021-06-27 11:57:28 +10:00
Matt Joiner 9c81516139 Check that udp conn ID age is non-zero 2021-06-25 15:00:39 +10:00
Matt Joiner ff8557cf7e Add http tracker AllowKeepAlive 2021-06-25 15:00:09 +10:00
Matt Joiner a570b83870 Update and expose default client identifiers 2021-06-25 11:29:59 +10:00
Matt Joiner d4bf547801 Add udp tracker scrape support 2021-06-24 23:13:35 +10:00
Matt Joiner 65f507a792 Pull AnnounceOpt into tracker package 2021-06-24 23:13:35 +10:00
Matt Joiner a3159e6b11 Cancel writer after request 2021-06-24 23:13:35 +10:00
Matt Joiner 4bcf71c729 Don't log dispatch errors 2021-06-24 23:13:35 +10:00
Matt Joiner 98a1423732 Extract protocol agnostic tracker Client 2021-06-24 23:13:35 +10:00
Matt Joiner 101a269873 Rewrite udp announce to use udp client 2021-06-24 23:13:35 +10:00
Matt Joiner c3c982b621 Fixes for wasm 2021-06-23 17:24:50 +10:00
Matt Joiner 42a2fb445f Rearrange some tracker tests and files 2021-06-22 23:32:27 +10:00
Matt Joiner af8c41ebe9 Extract HTTP tracker client into separate package 2021-06-22 23:28:26 +10:00
Matt Joiner 8df885cd81 Move tracker test server code to test file 2021-06-22 22:48:49 +10:00
Matt Joiner 2ddddad6f7 Update test tracker urls 2021-06-22 22:45:56 +10:00
Matt Joiner 98630dfc3d Fix tracker test timeouts 2021-06-22 22:45:50 +10:00
Matt Joiner 333c878d2b Rewrite UDP tracker client 2021-06-22 22:36:43 +10:00
Matt Joiner 582f0ccd48 Add UDP tracker announce and connect expvars 2021-06-22 16:52:55 +10:00
Matt Joiner c714cb6992 Fix some go vet warnings 2021-02-03 19:42:46 +11:00
Matt Joiner 29cc20ede9 Fix "none" event for WebTorrent announces 2020-12-30 11:43:48 +11:00
Matt Joiner b67ccab7f2 Pass trackerScraper context to announces
This will cancel announces for Closed Torrents and let them move more quickly to announcing the stopped event. Spotted by @hwh33.
2020-12-21 09:29:20 +11:00
Matt Joiner 14f2e8087e Fix unused import 2020-10-01 11:50:42 +10:00
Matt Joiner 01dfc28484 Set tracker announce timeout back to default
Add lots of comments about how this works and why.
2020-10-01 11:45:47 +10:00
Matt Joiner 93685a55fe Include ip param in http announces 2020-10-01 10:46:27 +10:00
Matt Joiner e1d59f791e Pass key param in http announces 2020-10-01 10:45:29 +10:00
Matt Joiner 010362ec82 Rework HTTP announce timeouts
Use Request.Context to implement timeouts, set the default to 3s for announces from the Client.
2020-10-01 10:45:05 +10:00
Matt Joiner a1a715f362 Improve cmd/tracker-announce output 2020-05-20 12:04:53 +10:00
Matt Joiner 04ff050ecd Disable keepalives for http trackers
Should work around an issue with S3 trackers holding connections open for very long periods.
2020-04-28 09:15:06 +10:00
Matt Joiner 376ff763fe Apply staticcheck 2020-02-20 11:09:57 +11:00
Anthony Raymond 8638ed1c75 Anthonyraymond export well known (#346)
* Export HttpResponse from tracker/http.go

* Update http_test.go
2019-11-20 16:31:54 +11:00
Anthony Raymond ec56d59137 Export Peer function (#343)
* Export function to be use-able in library

* Update method call
2019-11-15 10:22:59 +11:00
Matt Joiner cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10:00
Matt Joiner 9224303c1e Update all imports of dht to v2 2019-08-10 18:46:07 +10:00
Matt Joiner 27b7fbe3f3 Fix announcing to S3 HTTP trackers 2019-07-17 18:12:11 +10:00
davtoro f40140283a check if peer id exists 2019-04-15 17:58:23 +10:00
Matt Joiner cd06ab16ac tracker: Fix network error handling in unit test 2019-01-08 19:21:15 +11:00
Matt Joiner 2789a4ff39 tracker: Fix some comments 2018-11-28 12:02:25 +11:00
Matt Joiner 3e3f2e4128 tracker: Add Announce.Context
Use it to rewrite a test that fails with recent go versions due to logging after test completion.
2018-11-28 12:02:12 +11:00