routing/route/route: add optional MPP field to Hop

This commit also modifies the Router serialization to persist the MPP
struct when present, and properly restore it when loading from disk.
This commit is contained in:
Conner Fromknecht committed 2019-11-04 14:11:28 -08:00
1 parent b1b7ff8006
commit 6d971e5113
5 files changed
+116 -6

No files matched your search

+8
View File
@@ -85,6 +85,14 @@ func (f *Record) Encode(w io.Writer) error {
return f.encoder(w, f.value, &b)
}
// Decode read in the TLV record from the passed reader. This is useful when a
// caller wants decode a *single* TLV record, outside the context of the Stream
// struct.
func (f *Record) Decode(r io.Reader, l uint64) error {
var b [8]byte
return f.decoder(r, f.value, &b, l)
}
// MakePrimitiveRecord creates a record for common types.
func MakePrimitiveRecord(typ Type, val interface{}) Record {
var (