tailcfg: add marshaling round-tripping test.

Temporary until #3206 goes away, but having changed the marshal/unmarshal
implementation I got nervous about the new one doing the correct thing.
Thankfully, the test says it does.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2021-10-29 15:21:41 -07:00
parent 27e83402a8
commit 15d329b4fa
2 changed files with 42 additions and 0 deletions

View File

@@ -1160,6 +1160,9 @@ func (k *NodeKey) UnmarshalText(text []byte) error {
nk.AppendTo(k[:0])
return nil
}
func (k NodeKey) AsNodePublic() key.NodePublic {
return key.NodePublicFromRaw32(mem.B(k[:]))
}
// IsZero reports whether k is the zero value.
func (k NodeKey) IsZero() bool { return k == NodeKey{} }