2
0
mirror of synced 2025-02-24 14:48:27 +00:00

95 Commits

Author SHA1 Message Date
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
3820017a0c Add last_used to sqlite storage 2020-10-13 09:36:58 +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
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
235c67a6ec Remove debug logging from storage file implementation 2020-06-01 11:12:51 +10:00
Matt Joiner
604af2be82 storage file implementation: Error on short writes 2020-06-01 11:12:33 +10:00
Matt Joiner
69a0f2f1e4 Got file storage working with segment index 2020-06-01 00:14:51 +10:00
Matt Joiner
7fec6785bf Abstract out segments mapping and use it in mmap storage 2020-05-31 21:00:19 +10:00
Matt Joiner
c04f09ee42 Fix panic closing torrent that failed to open storage 2020-05-21 12:17:10 +10:00
Matt Joiner
ae9aaaaa20 Use anacrolix/log in storage completion 2020-05-03 14:10:46 +10:00
Matt Joiner
2ea04e9083 Use default bbolt package alias 2020-03-24 12:55:03 +11:00
Matt Joiner
7175dba614 Fix bbolt compatibility with go1.14 2020-03-24 12:55:03 +11:00
Matt Joiner
19ce53e69f Make io.EOF an expected error from storage.Piece.ReadAt
Fixes #381.
2020-02-27 16:45:57 +11:00
Matt Joiner
c855c7a366 Differentiate between storage.ClientImpl{,Closer} 2020-02-21 14:12:44 +11:00
Matt Joiner
72e54fb353 Resource per piece storage: Store incomplete chunks separately 2020-01-14 10:51:09 +11:00
Matt Joiner
83867dbbe9 Move entirely to etcd-io/bbolt 2019-11-04 09:19:07 +11:00
Matt Joiner
e7bd5c2991 Replace github.com/boltdb/bolt with github.com/etcd-io/bbolt 2019-10-12 11:07:49 +11:00
Matt Joiner
e3420e0b60 Don't close shared client piece completion in mmap storage
Fixes #335.
2019-10-11 17:37:22 +11:00
Matt Joiner
cecd83f966 Don't ignore error getting mmap piece completion 2019-10-11 17:36:46 +11:00
Matt Joiner
cb1bf0f413 goimports -local 2019-08-21 20:58:40 +10: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
bd5ae2cb6d Fix doc comment 2018-07-15 12:56:28 +10:00
Ian Bishop
ffd41230a6 Fix file permissions 2018-06-09 15:11:28 +02:00
Matt Joiner
a101ebb07e package assert->expect 2018-04-12 11:34:24 +10:00
Matt Joiner
6441e98f62 Implement go vet recommendations 2018-02-02 19:28:09 +11:00
Matt Joiner
e686523178 storage: Export NewSqlitePieceCompletion 2018-01-12 11:09:33 +11:00
Matt Joiner
d5e2d7ce99 storage: Don't check completion state on every write 2018-01-12 10:45:19 +11:00
Matt Joiner
f3ff3821ec file storage: Report errors getting completion 2018-01-12 10:41:42 +11:00
Matt Joiner
78e23734d4 Clarify the PieceCompletion.Set method bool argument 2018-01-11 22:10:52 +11:00
Matt Joiner
a82c76defb Update sqlite3 piece completion 2018-01-11 22:10:00 +11:00
Matt Joiner
09218898e9 Use NoSync with bolt storage and piece completion
Fixes terrible slowness on Linux.
2018-01-09 23:11:34 +11:00
Matt Joiner
57fec52371 mmap_span: Synchronize access to memory maps to avoid race when unmapping 2018-01-06 16:39:52 +11:00
Matt Joiner
6bcf2a58b2 storage: Rename mmapStorage->mmapClientImpl 2018-01-06 16:38:41 +11:00
Matt Joiner
b9a1cb5b8b missinggo.LimitLen changed 2017-12-03 13:44:08 +11:00
Matt Joiner
520da249a1 Test that mmap size doesn't exceed system memory address width
Should fix http://paste.ubuntu.com/26074620/
2017-12-02 10:26:09 +11:00
Matt Joiner
4190856b6c sortimports 2017-12-01 18:12:29 +11:00
Matt Joiner
cecc70f4cc More megacheck 2017-11-08 00:12:34 +11:00
Matt Joiner
dd083a4e11 Track completion known to implementation state
Addresses #193
2017-10-12 16:09:32 +11:00
Matt Joiner
018afed5a7 storage: Remove incorrect comment 2017-09-23 15:27:26 +10:00
Matt Joiner
9e6cdff175 storage: Don't add empty mmaps to the mmap span 2017-09-18 13:41:19 +10:00
Matt Joiner
19adb2cac3 Improve mmap storage error messages
Trying to map unusual Info's gave unhelpful messages.
2017-09-18 12:19:34 +10:00
Matt Joiner
cee24fe21b storage: Add TODO about handling Close errors 2017-09-12 18:31:56 +10:00
mlmhl
edcb9deb95 bug fix: initial infoHash for mmapStoragePiece 2017-07-10 19:33:39 +08:00
Matt Joiner
49648b9ae1 Close implicit Client default storage on Client.Close
Fixes #158
2017-06-01 22:57:08 +10:00
Matt Joiner
c2f77fc84a Make bolt completion DB directory if necessary 2017-06-01 11:20:50 +10:00
mlmhl
d8c7f37d2b make pieceCompletion configurable 2017-05-22 10:23:37 +08:00
Matt Joiner
65a7c3daa7 storage: Fix race condition in mapPieceCompletion 2017-03-30 21:38:44 +11:00