Commit Graph

22 Commits

Author SHA1 Message Date
Matt Joiner cf85d70a5c bencode: Rename string_values->stringValues 2019-12-23 13:39:34 +11:00
Matt Joiner e236cbf145 bencode: Fix marshalling of []byte(nil)
Also fixes #293.
2018-11-27 08:57:17 +11:00
Matt Joiner bf5552ae3c bencode: Remove a lot of expensive allocations 2018-07-25 13:42:28 +10:00
Matt Joiner 2eb98189ff bencode.Marshal: Get rid of the intermediate buffer 2018-07-23 10:50:18 +10:00
Matt Joiner b00711bb68 bencode: Avoid Value.Interface call testing for big.Int
Was resulting in significant allocation.
2018-07-17 21:25:15 +10:00
Matt Joiner 1f3eace72f bencode: Add ignore_unmarshal_type_error tag 2018-01-27 14:31:46 +11:00
Matt Joiner 74c5d425fb bencode: Handle encoding big.Ints 2017-11-08 21:34:24 +11:00
Matt Joiner 7b2561cea8 bencode: More renames 2016-08-26 14:51:38 +10:00
Matt Joiner f2cbc873a5 bencode: Rename a bunch of slug case stuff 2016-08-26 13:13:30 +10: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 ff835db955 Actually fix #41 properly; and several big changes
bencode:
 * Handle omitempty on non-trivial types.
cmd/dht-ping:
 * Handle timeouts in ping transactions.
dht:
 * Propagate failed transaction responses properly.
 * Msg related tests are moved into their own file.
 * In some places, IPs in binary form are shorted to 4 bytes if IPv4.
2015-12-07 03:28:28 +11:00
Matt Joiner 47a2453098 bencode: Can't get zero type of a nil interface 2015-10-23 12:37:30 +11:00
Matt Joiner 837bdd2ccf bencode: Rethrow non-errors during encoding 2015-10-23 12:36:47 +11:00
Matt Joiner 1fb64de07c bencode: Encoding nil interfaces are an error except at data root 2015-10-23 12:35:38 +11:00
Matt Joiner 4b539b1f11 bencode: Don't skip encoding nil pointers and interfaces
This caused an annoying bug for complex types where dictionary values went missing.
2015-10-19 01:28:36 +11:00
Matt Joiner ddf7cbbdac bencode: Use default field name if it isn't given (but options are) 2015-10-19 01:27:15 +11:00
Matt Joiner 644ee0a244 bencode: Tidy up 2015-10-19 01:25:56 +11:00
nsf e553531a10 Fix bugs, implement missing bits. Made a mess, can't describe properly. 2012-06-28 02:21:26 +06:00
nsf 110956d936 Fix Marshaler case. 2012-06-24 17:10:53 +06:00
nsf 8db0c29da9 Add bufio.Writer error handling, move Flush to the internal code. 2012-06-24 16:59:04 +06:00
nsf a68e4a6f5a Initial commit. 2012-06-20 19:21:32 +06:00