Commit Graph

51 Commits

Author SHA1 Message Date
Matt Joiner 42d29d95a6
Import generics as g 2023-04-04 19:12:26 +10:00
Matt Joiner e8b04c7181
gofumpt 2023-02-18 18:35:22 +11:00
Marco Vidonis 3909c6c125
Add customer headers when dialling WS connection to tracker (#789)
* expose WebtorrentTrackerHttpHeader field
2022-12-08 09:17:33 +11:00
Matt Joiner 3e0f34934d
gorond ./... 2022-11-15 23:31:27 +11:00
Matt Joiner 309a900b9a
Close data channel on offer init errors 2022-07-12 16:15:51 +10:00
Matt Joiner 3aa2320442
Also close created data channels when cleaning up webrtc conns 2022-07-12 16:15:50 +10:00
Matt Joiner cf58c53ad4
Support announcing to webtorrent trackers without offers 2022-07-12 16:15:50 +10:00
Matt Joiner 9694c66b36
webtorrent: Create data channel earlier per webrtc examples 2022-07-12 16:15:50 +10:00
Matt Joiner d9ca26dabb
Close detached data channel and end span on webrtc conn close 2022-07-12 16:15:50 +10:00
Matt Joiner c17018d04e
Add tracing to webtorrent webrtc resources 2022-07-12 16:15:49 +10:00
Matt Joiner aedf2583cc
Remove relevant webtorrent offers when closing Torrent
(cherry picked from commit 73a0b5e4d2fe679aac31d87171537c70f91f46ee)
2022-07-12 15:49:58 +10:00
Matt Joiner 67df8f8cdb
Fix webrtc logging for JS build 2022-04-11 14:53:02 +10:00
alex.sharov fc3faca117 discard logger factory 2022-04-09 14:06:05 +07:00
Matt Joiner c47e6b1f60 Use webrtc selected ICE candidate for peer addresses 2022-01-22 18:35:06 +11:00
Matt Joiner b668c826e2 Rename webtorrent source files 2022-01-22 18:34:35 +11:00
martin b6cc93c0be * set proxy of websocket tracker to the proxy used by client config 2021-12-16 16:04:59 +11:00
Matt Joiner 1d787c3923 Add generalized decodeJsonByteString and a fuzz target for it 2021-12-12 16:56:01 +11:00
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
Matt Joiner e7426133e2 Quote webrtc offer ID as ASCII-only 2021-10-25 21:03:51 +11:00
Matt Joiner e178f99f35 Fix race running and closing webtorrent tracker clients 2021-10-25 16:15:42 +11:00
Matt Joiner bdcba73cf9 Fix race in webtorrent dial stats 2021-05-14 15:42:25 +10:00
Sean DuBois 8749bd9697 Upgrade to pion/webrtc@v3 2021-02-21 13:46:37 -08:00
Shubhendra Singh Chauhan 0cdb33ede0 fixed code quality issues using DeepSource
* Added .deepsource.toml

* Removed empty default in select

* Removed unnecessary use of slice

* Fixed check for empty string
2021-01-30 15:23:49 +11:00
Justin M b6ad979670 Fix panic on Ping/WriteMessage for webtorrent
Introduced in anacrolix/torrent #455
2021-01-17 15:39:59 +11:00
Justin M f33b3ba5ce Ping websocket to ensure connect remains online.
OpenWebTorrent disconnects clients after two minutes of inactivity. In a scenario where an
announce occurs and no other activity occurs for the (default) 120-second idle timer, the
websocket will be torn down by OpenWebTorrent. This in turn causes the tracker client to wait one
minute, reconnect, and reannounce its peers.

This patch sends a websocket.PingMessage every 60 seconds to maintain the connection.
2021-01-06 14:30:01 +11:00
Justin M ae9d5bce18 Align webtorrent tracker to BEP-3
Adding "omitempty" to json marshalling, bringing the webtorrent tracker AnnounceRequest in line
with BEP-3, which states omitting the the "event" field is acceptable.
2021-01-05 11:38:39 +11:00
Justin M b2ab540f93 Reannounce webtorrent webrtc offers on reconnect
On socket reconnect, reannounce any webrtc offers that might have been half-open before the
socket reconnected. This implementation closes any existing half-open offers and republishes them,
but does nothing to existing webrtc connections which are still running (these are cleaned up
elsewhere and are not owned by this code)
2021-01-05 11:38:16 +11:00
Matt Joiner c3696aa5a4 Fix race in webtorrent.TrackerClient.Run 2020-06-01 11:11:41 +10:00
Matt Joiner cc5d2abe18 doc comment 2020-05-05 09:00:43 +10:00
Matt Joiner 54d55db108 webtorrent: Synchronize access to PeerConnection.Close 2020-05-03 18:45:12 +10:00
Matt Joiner f36fc10079 Fix crash when announcing unloaded torrent to websocket 2020-05-03 14:10:46 +10:00
Matt Joiner 188aa800b2 Adjust websocket tracker logging levels 2020-04-28 09:14:24 +10:00
Matt Joiner 3226dc1ccd Rename per-torrent ws tracker and output stats 2020-04-22 11:42:31 +10:00
Matt Joiner 0ab6d108be Pool webtorrent tracker websockets at the Client level 2020-04-21 18:08:43 +10:00
Matt Joiner cc69c3ec8f New metrics and log change 2020-04-20 14:00:29 +10:00
Matt Joiner fb6af2a426 Remove unused outbound offer answered field 2020-04-20 14:00:10 +10:00
Matt Joiner c074b30d94 Log webrtc connection errors and rework webtorrent.TrackerClient 2020-04-20 13:42:25 +10:00
Matt Joiner 520d3c38e3 Fix some webtorrent PeerConnection leaks 2020-04-20 10:21:31 +10:00
Matt Joiner d05ce2d274 Update anacrolix/log 2020-04-16 17:20:58 +10:00
Matt Joiner 0123f5e6f6 More error handling and logging clean up 2020-04-14 10:47:26 +10:00
Matt Joiner 05e448d132 webtorrent logging improvements 2020-04-13 19:13:23 +10:00
Matt Joiner 93366bb63a Rename webtorrent.NewClient->NewTrackerClient 2020-04-13 19:12:54 +10:00
Matt Joiner e5fd9ede54 Tidy up the webtorrent package, remove buffer 2020-04-13 14:31:39 +10:00
Matt Joiner 1b3cbc1287 Improve webtorrent tracker client logging 2020-04-13 14:17:46 +10:00
Matt Joiner f45dac1e38 Use offer_id for webrtc conn string 2020-04-13 14:04:34 +10:00
Matt Joiner 6f2c65fe33 Big tidy up of webtorrent code 2020-04-07 14:30:27 +10:00
Matt Joiner bcdccb1ff3 Refactoring in webtorrent.Transport 2020-04-07 12:17:21 +10:00
Matt Joiner 27bfdd0dbf Create peer connections when WebRTC connections obtain a data channel 2020-04-07 10:59:10 +10:00
Matt Joiner 77cbbec926 Start using the webtorrent package 2020-04-06 16:45:47 +10:00
Matt Joiner ae4e5270c2 Fix formatting directives 2020-04-06 14:14:13 +10:00