types/key: export constants for key size, not a method.

Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
David Anderson
2021-10-29 17:35:51 -07:00
parent 6422789ea0
commit 84c3a09a8d
6 changed files with 17 additions and 21 deletions

View File

@@ -123,7 +123,7 @@ func (m *Ping) AppendMarshal(b []byte) []byte {
dataLen := 12
hasKey := !m.NodeKey.IsZero()
if hasKey {
dataLen += m.NodeKey.RawLen()
dataLen += key.NodePublicRawLen
}
ret, d := appendMsgHeader(b, TypePing, v0, dataLen)
n := copy(d, m.TxID[:])
@@ -141,8 +141,8 @@ func parsePing(ver uint8, p []byte) (m *Ping, err error) {
p = p[copy(m.TxID[:], p):]
// Deliberately lax on longer-than-expected messages, for future
// compatibility.
if len(p) >= m.NodeKey.RawLen() {
m.NodeKey = key.NodePublicFromRaw32(mem.B(p[:m.NodeKey.RawLen()]))
if len(p) >= key.NodePublicRawLen {
m.NodeKey = key.NodePublicFromRaw32(mem.B(p[:key.NodePublicRawLen]))
}
return m, nil
}