Commit Graph

20 Commits

Author SHA1 Message Date
Matt Joiner c6ee03f449 gofumpt 2021-11-08 14:47:01 +11:00
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 a76fad32eb Fix panic unmarshalling bencode dict into unsupported type 2021-08-12 12:16:53 +10:00
Matt Joiner 259356ccd6 Rework bencode decoding so it might support embedded structs 2021-06-07 13:01:40 +10:00
Matt Joiner 376ff763fe Apply staticcheck 2020-02-20 11:09:57 +11:00
Matt Joiner bf5552ae3c bencode: Remove a lot of expensive allocations 2018-07-25 13:42:28 +10:00
Matt Joiner 04fa1b8d4c Support marshalling bencode strings into byte arrays 2018-07-11 15:22:29 +10:00
Matt Joiner 4b5203851a bencode: Support unmarshalling strings into slices of kind Uint8 2018-02-13 00:44:05 +11:00
Matt Joiner 1f3eace72f bencode: Add ignore_unmarshal_type_error tag 2018-01-27 14:31:46 +11:00
Matt Joiner edf2495b1f Expose bencode.Decoder.Offset 2017-11-05 15:42:37 +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 911423307d Add a test for bdecoding consecutive dicts 2017-10-26 14:26:27 +11:00
Matt Joiner 28c1536daf bencode: When decoding a dict, if the final key is missing its value, don't treat that as an error.
I think I'm swayed here by the robustness principle/Postel's Law.
2015-10-02 00:13:43 +10:00
Matt Joiner 87158e594a Derp 2015-09-20 21:09:55 +10:00
Matt Joiner 8949375bd6 bencode: Decode very large integers as big.Int if they overflow int64 2015-09-20 21:08:42 +10:00
Matt Joiner a101f9bcbd bencode: Remove trailing bytes checks, this broke the peer protocol and should be a new API 2015-08-23 19:24:29 +10:00
Matt Joiner baf389aa8c bencode: Add tests for Unmarshalling trailing bytes, and extraneous 'e' 2015-08-23 16:13:30 +10:00
nsf e553531a10 Fix bugs, implement missing bits. Made a mess, can't describe properly. 2012-06-28 02:21:26 +06:00
nsf 27b64a002c Add a couple of decode tests, fix empty slice bug. 2012-06-22 19:34:26 +06:00
nsf a68e4a6f5a Initial commit. 2012-06-20 19:21:32 +06:00