aefec9b10f
This commit adds an additional return value to Stream.DecodeWithParsedTypes, which returns the set of types that were encountered during decoding. The set will contain all known types that were decoded, as well as unknown odd types that were ignored. The rationale for the return value (rather than an internal member) is so that the stream remains stateless. This return value can be used by callers during decoding to make assertions as to whether specific types were included in the stream. This is need, for example, when parsing onion payloads where certain fields must be included/omitted depending on the hop type. The original Decode method would incur the additional performance hit of needing to track the parsed types, so we can selectively enable this functionality when a decoder requires it by using a helper which conditionally tracks the parsed types. |
||
---|---|---|
.. | ||
bench_test.go | ||
primitive_test.go | ||
primitive.go | ||
record_test.go | ||
record.go | ||
stream_test.go | ||
stream.go | ||
tlv_test.go | ||
truncated_test.go | ||
truncated.go | ||
varint_test.go | ||
varint.go |