Commit Graph

2527 Commits

Author SHA1 Message Date
Matt Joiner c1d189ed31 Performance improvements to PEX 2020-10-23 08:58:55 +11:00
Matt Joiner 8088002ba6 Fix error handling for bad torrent adds with safe file handling 2020-10-15 16:03:43 +11:00
Matt Joiner 89235e180f Sanitize metainfo file paths for file-based storage
Fixes exploit where specially crafted infos can cause the client to write files to arbitrary locations on local storage when using file-based storages like mmap and file.
2020-10-15 15:45:08 +11:00
Matt Joiner 635ec27fb3 Don't update requests for the current connection first when a request is deleted 2020-10-15 12:56:06 +11:00
Matt Joiner 0b726a899b We might want to close webseed peers on response errors 2020-10-15 12:45:19 +11:00
Matt Joiner 30d0b5b9c7 webseed: Handle http response status codes 2020-10-15 12:42:27 +11:00
Matt Joiner 4a4cb5dc58 Ensure PeerConn._close is called for incoming connections
This fixes missing calls to PeerConnClosed callback.
2020-10-14 15:11:45 +11:00
Matt Joiner 07bc79dbdc Test both sqlite file and in-memory leecher storages 2020-10-13 13:34:05 +11:00
Matt Joiner 02f82131ea Move pexConnState from peer to PeerConn 2020-10-13 13:33:22 +11:00
Matt Joiner 152d8715ff Add PeerConnClosed callback 2020-10-13 13:02:39 +11:00
Matt Joiner 3820017a0c Add last_used to sqlite storage 2020-10-13 09:36:58 +11:00
Matt Joiner ad10a09982 Use bind-blob fix for crawshaw.io/sqlite 2020-10-12 17:13:05 +11:00
Matt Joiner 6ed1062176 Fix some log levels 2020-10-12 17:12:34 +11:00
Matt Joiner d820f7861c Add a sqlite data storage implementation 2020-10-11 12:58:27 +11:00
Matt Joiner 00ac333ea2 Panic on bad piece per resource chunk names
This was masking a bug in a coming sqlite storage implementation. Maybe it could be relaxed to checking for no filepath.Dir in the future.
2020-10-11 12:57:33 +11:00
Matt Joiner 417d7d1d48 Tweaks to storage error and completion handling 2020-10-11 12:54:03 +11:00
Matt Joiner 898260c177 Tidy up some storage close handling 2020-10-11 12:40:43 +11:00
Matt Joiner 3d7a95a65d Use testing.T.Name instead of missinggo.GetTestName
This handles subtests correctly, and removes the need to specify when to export due to collisions with the old function.
2020-10-10 10:59:17 +11:00
Matt Joiner a9102abf1d Tidy up some logging 2020-10-10 10:24:58 +11:00
Matt Joiner d3daaaf75a Fix webseed requests for non-trivial path components 2020-10-07 10:22:55 +11:00
Matt Joiner 014cb3986b Fix PeerConn conn status string 2020-10-06 09:50:47 +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 3d7ac87e3b Expose Client.ConnStats 2020-10-01 11:20:44 +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 a3827099c4 Limit simultaneous announces to the same URL 2020-10-01 10:43:10 +10:00
Matt Joiner a2c7b384df Limit half-open connections at the Client level 2020-09-30 16:56:27 +10:00
Matt Joiner f5c6f28985 Rename struct size test 2020-09-29 16:42:52 +10:00
Matt Joiner 808fd4b382 Optimize padding on Piece 2020-09-29 16:37:58 +10:00
Matt Joiner c2ba2aa417 Add a test for Piece size 2020-09-29 16:24:43 +10:00
Matt Joiner 1cdae13700 Fix conn status string for WebRTC connections 2020-09-29 16:21:54 +10:00
Matt Joiner 4dee11efe9 Fix panic for unexpected piece rejections
Should fix #419.
2020-09-03 14:34:06 +10:00
Matt Joiner e992bb78b9
Add to downstream projects in README
CortexFoundation/torrentfs
2020-08-11 11:43:12 +10:00
Matt Joiner dd906f8fa7 Add ReadExtendedHandshake callback 2020-07-15 16:16:14 +10:00
Matt Joiner 9d0ea15044 Expose peer.RemoteAddr 2020-07-15 16:16:14 +10:00
Matt Joiner 7455b98a0f Switch to crawshaw.io/sqlite
I'm using it elsewhere, and it seems to conflict when linking with github.com/mattn/go-sqlite3.
2020-07-15 16:16:14 +10:00
Matt Joiner 7ee0fdafe3 Add some client callbacks 2020-07-15 16:16:14 +10:00
Matt Joiner 70504464ec
Add PkgGoDev badge 2020-07-15 08:39:44 +10:00
Matt Joiner 8a98866d06 Pull in go-libutp fix for race 2020-07-10 13:24:08 +10:00
Matt Joiner fde583e51e Support -testPeer addresses that need resolving
Fixes #395.
2020-07-10 13:21:24 +10:00
Matt Joiner 4e541951eb Handle errors in webseed peers for bad URLs 2020-07-10 13:18:33 +10:00
Matt Joiner dd51e99b88 Update bbolt 2020-06-19 12:24:03 +10:00
Matt Joiner e81d8890dd Don't filter context cancel errors
The caller thinks this means it succeeded, when it fact it was cancelled and it should interpret that appropriately.
2020-06-19 11:41:26 +10:00
Matt Joiner 12ace95493 Tidy up webseed peer naming and unused types 2020-06-04 11:58:18 +10:00
Matt Joiner 62e7f29a0c Fix panic in webseed request rejection logging
Also use a new helper in Logger to simplify things.
2020-06-04 11:51:17 +10:00
ucwong 645901636d torrent : add udp scheme to 'switch case' 2020-06-04 10:37:50 +10:00
Maxb a7689f52bd Add DisallowDataDownload/Upload to TorrentSpec and small log cleanup 2020-06-04 10:36:56 +10:00
Matt Joiner 8606385985
Merge pull request #410 from anacrolix/webseeds
* Rename Peer to PeerInfo, and unexport PeerInfos

* Break peer out from PeerConn

* Abstract out segments mapping and use it in mmap storage

* Got file storage working with segment index

* Fix race in webtorrent.TrackerClient.Run

* storage file implementation: Error on short writes

* Remove debug logging from storage file implementation

* cmd/torrent-verify: Fix piece hash output

* Support disabling webtorrent

* Further progress on webseeding

* Handle webseed Client events

* Rename fastestConn->fastestPeer

* Add webseeds from magnet links

* Remove events from webseed

Manage this stuff inside the webseed peer instead.

* Make use of magnet source fields and expose Torrent.MergeSpec

* Add option to disable webseeds

* Fix webseeds when info isn't available immediately

* Handle webseed request errors

* Tidy up the interface changes
2020-06-03 11:25:08 +10:00