Commit Graph

20 Commits

Author SHA1 Message Date
Matt Joiner 901a8b1b36 Don't panic on int parse failures
This means for UnmarshalTypeErrors we now include context. There are still some other error types remaining that are thrown up via panic.
2021-08-12 13:46:02 +10:00
Matt Joiner 364c7d862e Add to bencode.Unmarshal doc comment 2021-06-21 17:58:04 +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 d4584c2ca6 bencode: Improve UnmarshalTypeError string and list parsing error context
Helps with #297.
2019-06-13 12:35:11 +10:00
Matt Joiner 2eb98189ff bencode.Marshal: Get rid of the intermediate buffer 2018-07-23 10:50:18 +10:00
Matt Joiner 1f6ba94882 Make extended handshake a struct, and move a bunch of extended stuff into peer_protocol 2018-07-10 12:20:36 +10:00
Matt Joiner dd9244c01d bencode: Unmarshal now returns an error on unused trailing bytes 2018-02-13 00:21:28 +11:00
Matt Joiner fce1fe1661 bencode: Implement unbuffered scanner used by NewDecoder
Minimizes unused reads into the input Reader stream
2017-11-05 15:39:36 +11:00
Matt Joiner 727d002e5a bencode.Encoder: Unembed the Writer and wrap it in a minimal interface
I won't remove the bufio.Buffer for Marshal now, it isn't a performance issue as far as I can tell, and I'd have to fake Flush().
2016-06-15 15:09:34 +10:00
Matt Joiner ac3b40ace3 bencode: Remove private types encoder and decoder
Instead the functionality is exposed directly on the public types.
2016-06-15 15:00:51 +10:00
Matt Joiner d9b7e7f297 bencode.Unmarshal: Remove unnecessary intermediate bufio.Reader 2016-06-15 14:54:40 +10:00
Matt Joiner 9d1a33facc bencode: Unembed the Reader type, and minimize the interface surface
Want to remove some unnecessary allocations.
2016-06-15 14:51:58 +10:00
Seth Hoenig 9f4bf70e17 refactor struct identifiers to follow conventional go names 2016-04-18 23:11:11 -05:00
Matt Joiner 577ea21793 Revert "bencode: Trailing bytes on Unmarshal is an error"
This reverts commit ad73a0ea89.
2015-08-23 19:10:22 +10:00
Matt Joiner ad73a0ea89 bencode: Trailing bytes on Unmarshal is an error 2015-08-23 17:47:01 +10:00
Matt Joiner cdfba7a1ac Expose SyntaxError reason with a proper error 2014-11-18 22:08:08 -06:00
nsf d0429086be Add more comments to the bencode library. Implement UnmarshalerError. 2012-06-30 22:26:20 +06:00
nsf 8db0c29da9 Add bufio.Writer error handling, move Flush to the internal code. 2012-06-24 16:59:04 +06:00
nsf f8f98eb7cd Add missing interface definitions. 2012-06-22 19:34:04 +06:00
nsf a68e4a6f5a Initial commit. 2012-06-20 19:21:32 +06:00