lnd/tlv
Olaoluwa Osuntokun 63e86b72c5
tlv: add new RecordT[T, V] utility type
In this commit, we add a new type, `RecordT[T, V]` to reduce some of the
common boiler plate for TLV types. This type lets you take either a
primitive type, or an existing Record, and gain common methods used to
create tlv streams.

It also serves as extra type annotation as well, since wire structs can
use this to wrap any existing type and gain the relevant record methods.

This implementation ensures that the very definition of the field also
binds the TLV type value. It does this by using the generated code to
map a struct like TlvType1 to an actually Type like Type(1).
2023-12-12 17:47:10 -08:00
..
internal/gen tlv/internal: add new internal package for generating TLV type structs 2023-12-12 17:47:01 -08:00
fuzz_test.go tlv: Added bool to primitive 2023-10-16 14:21:25 +01:00
go.mod tlv: add new RecordT[T, V] utility type 2023-12-12 17:47:10 -08:00
go.sum tlv: add new RecordT[T, V] utility type 2023-12-12 17:47:10 -08:00
primitive_test.go tlv: Added bool to primitive 2023-10-16 14:21:25 +01:00
primitive.go tlv: simplify encoding functions 2023-11-13 11:30:17 -06:00
record_test.go tlv: remove unused error return value 2019-12-04 13:27:29 +01:00
record_type_test.go tlv: add new RecordT[T, V] utility type 2023-12-12 17:47:10 -08:00
record_type.go tlv: add new RecordT[T, V] utility type 2023-12-12 17:47:10 -08:00
record.go tlv: Added bool to primitive 2023-10-16 14:21:25 +01:00
stream_test.go tlv: allow tlv streams to use large records in non-p2p setting 2022-09-14 15:48:13 -04:00
stream.go tlv: allow tlv streams to use large records in non-p2p setting 2022-09-14 15:48:13 -04:00
tlv_test.go tlv: allow tlv streams to use large records in non-p2p setting 2022-09-14 15:48:13 -04:00
tlv_type_param.go tlv: run go generate for new set of TLV types 2023-12-12 17:47:04 -08:00
tlv_types_generated.go tlv: run go generate for new set of TLV types 2023-12-12 17:47:04 -08:00
truncated_test.go tlv: simplify byte slice comparison as recommenteded by static analysis 2020-04-24 19:15:08 +02:00
truncated.go tlv: simplify encoding functions 2023-11-13 11:30:17 -06:00
varint_test.go tlv: simplify byte slice comparison as recommenteded by static analysis 2020-04-24 19:15:08 +02:00
varint.go tlv+record+routing: add payload size calculation 2019-12-20 11:00:01 +01:00