2
0
mirror of synced 2025-02-23 22:28:11 +00:00

94 Commits

Author SHA1 Message Date
Matt Joiner
ac086bb3bd
Fix incorrect EOF when decoding some peer protocol message types
Hooray for pedantic fuzz tests. This was found through peer_protocol/FuzzDecoder, when I wrote a go-fuzz-all wrapper.

It probably never caused a problem in production, as EOF would be handled as stream termination anyway, but it isn't clean.
2023-05-29 19:01:01 +10:00
Matt Joiner
b18e824a6b
go1.19 compatibility 2023-05-23 20:55:30 +10:00
Matt Joiner
a8ab0baec8
Include holepunch message protocol family in metrics 2023-05-22 15:28:28 +10:00
Matt Joiner
97488efed7
Add holepunch message fuzzing 2023-05-22 15:27:06 +10:00
Matt Joiner
60db110439
Fix panic logging unknown holepunch error code 2023-05-21 19:29:35 +10:00
Matt Joiner
044be4820f
gorond test files 2023-05-12 13:47:47 +10:00
Matt Joiner
a11739a667
Attempt holepunch after initial dial fails 2023-05-11 13:03:54 +10:00
Matt Joiner
c202126a62
Add many more extension bit definitions 2023-05-09 15:46:53 +10:00
Matt Joiner
06a1aa0769
Synchronize holepunch connect messages with existing rendezvous 2023-05-09 15:45:50 +10:00
Matt Joiner
e86e624415
WIP support for ut_holepunch 2023-05-01 10:19:26 +10:00
Matt Joiner
1e13625c73
Misc debug status, pex conn tracking improvements 2023-05-01 10:19:24 +10: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
Matt Joiner
3e0f34934d
gorond ./... 2022-11-15 23:31:27 +11:00
Matt Joiner
bdb33ef9f7 gofumpt -extra 2021-12-23 14:00:00 +11:00
afjoseph
b33b45baf4 [fuzz] Put +build tags to support go1.16 as well 2021-11-01 11:26:58 +11:00
Matt Joiner
c18e0abe52 Fix incomplete Integer.Read
Possibly on read buffer boundaries, this would have caused errant io.ErrUnexpectedEOF.

(cherry picked from commit 22569449dad48e1c5cdeac171625585f8ca976c9)
2021-10-19 14:07:23 +11:00
Matt Joiner
118391c3bf Apply some lints from GoLand 2021-10-07 09:12:17 +11:00
Matt Joiner
4ed855070f Fix scheduling overhead in decoding benchmark 2021-09-30 11:52:50 +10:00
Matt Joiner
702cf3c8f7 Combine peer protocol fuzz targets into one file 2021-09-30 11:19:50 +10:00
Matt Joiner
2027028539 More optimizations in peer protocol message decoding 2021-09-30 11:05:01 +10:00
Matt Joiner
73696fd215 peer_protocol: Use faster form for Integer.{UnmarshalBinary,Read} 2021-09-30 10:24:03 +10:00
Matt Joiner
60a622ff4b Remove an allocation reading message length 2021-09-30 09:59:18 +10:00
Matt Joiner
709ee70b0c Try to avoid allocating buffer 2021-09-30 09:45:50 +10:00
Matt Joiner
b69e6dff01 Improvements to decoder fuzzing 2021-09-30 09:42:54 +10:00
Matt Joiner
1b66994c0a Add some fuzzing in peer_protocol 2021-09-30 09:01:10 +10:00
YenForYang
a8db640c62
Drop bradfitz/iter dependency (#605)
* Drop bradfitz/iter dependency

`range iter.N` looks nice and doesn't allocate, but unfortunately using a `range` expression blocks a function from being inlined wherever it's used (for now). It's not that we need inlining in all cases, but I do think a C-style for loop looks just as nice and is probably clearer to the majority. There also aren't any clear disadvantages to changing (unless you just happen to dislike the look of C)

* Update misc_test.go

* Update rlreader_test.go

* Update torrent_test.go

* Update bench_test.go

* Update client_test.go

* Update iplist_test.go

* Update mse_test.go

* Update peerconn_test.go

* Update peerconn.go

* Update order_test.go

* Update decoder_test.go

* Update main.go

* Update bench-piece-mark-complete.go

* Update main.go

* Update torrent.go

* Update iplist_test.go

* Update main.go
2021-09-14 13:46:50 +10:00
Matt Joiner
35064425eb go fmt ./... 2021-09-09 22:51:24 +10:00
YenForYang
99ba75f458 Drop xerrors and reflection dependency
Nothing wrong with missinggo.CopyExact -- but fewer dependencies is better IMO.  Also changed String() to use a consistent receiver name -- not a big deal.
2021-09-04 23:01:37 +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
c3c982b621 Fixes for wasm 2021-06-23 17:24:50 +10:00
Matt Joiner
15f8e77519 Add explicit metadata extension types 2021-06-21 12:14:06 +10:00
Matt Joiner
9ded7e7e87 Use bytes.Reader instead of bytes.Buffer in a few places 2021-05-05 15:48:57 +10:00
Matt Joiner
f409daa93f PORT message belongs to BEP 5 2021-01-27 17:08:15 +11:00
Matt Joiner
6aaaaaffba Fix unreferenced variable 2021-01-19 10:55:22 +11:00
Matt Joiner
c1d189ed31 Performance improvements to PEX 2020-10-23 08:58:55 +11:00
Matt Joiner
3e9a5a4aec Expose ClientConfig.Extensions
Also run the storage failure test with fast disabled for the seeder. This probably would have tickled some issues in the past, so it seems like a good place to try it out.
2020-04-23 13:03:40 +10:00
Yaroslav Kolomiiets
2b2c480706 PEX: add periodic deltas 2020-04-15 17:24:44 +10:00
Yaroslav Kolomiiets
93430aa01a PEX: add connection tracking 2020-04-15 17:24:44 +10:00
Yaroslav Kolomiiets
634edd2875 Share current connections with peers over PEX (anacrolix#341) 2020-04-15 17:24:44 +10:00
Matt Joiner
376ff763fe Apply staticcheck 2020-02-20 11:09:57 +11:00
Matt Joiner
5b0c895e09 Add comments 2019-10-01 18:13:55 +10: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
338287486f Always return errors when handshakes or dialing fails
I intend to use xerrors-style error handling for special cases.
2019-07-19 16:15:46 +10:00
Matt Joiner
63d215568a Tidy up function signature 2019-07-19 14:56:29 +10:00
Matt Joiner
e236cbf145 bencode: Fix marshalling of []byte(nil)
Also fixes #293.
2018-11-27 08:57:17 +11: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
91730696cf Rewrite piece data decoding and relax test 2018-07-14 11:50:43 +10:00
Matt Joiner
01380adac3 peer_protocol: Add a test for receiving overlong piece data
The chunk buffer pool decides the upper bound on chunk data len.
2018-07-14 11:37:56 +10:00
Matt Joiner
cc6441a791 Fix peer_protocol.Message.RequestSpec for Type Piece 2018-07-13 21:33:21 +10:00