mirror of
https://github.com/tailscale/tailscale.git
synced 2025-08-11 21:27:31 +00:00
types/key: export constants for key size, not a method.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
@@ -21,6 +21,10 @@ const (
|
||||
// This prefix is used in the control protocol, so cannot be
|
||||
// changed.
|
||||
discoPublicHexPrefix = "discokey:"
|
||||
|
||||
// DiscoPublicRawLen is the length in bytes of a DiscoPublic, when
|
||||
// serialized with AppendTo, Raw32 or WriteRawWithoutAllocating.
|
||||
DiscoPublicRawLen = 32
|
||||
)
|
||||
|
||||
// DiscoPrivate is a disco key, used for peer-to-peer path discovery.
|
||||
@@ -115,12 +119,6 @@ func (k DiscoPublic) AppendTo(buf []byte) []byte {
|
||||
return append(buf, k.k[:]...)
|
||||
}
|
||||
|
||||
// RawLen returns the length of k when to the format handled by
|
||||
// ReadRawWithoutAllocating and WriteRawWithoutAllocating.
|
||||
func (k DiscoPublic) RawLen() int {
|
||||
return 32
|
||||
}
|
||||
|
||||
// String returns the output of MarshalText as a string.
|
||||
func (k DiscoPublic) String() string {
|
||||
bs, err := k.MarshalText()
|
||||
|
@@ -33,6 +33,10 @@ const (
|
||||
// This prefix is used in the control protocol, so cannot be
|
||||
// changed.
|
||||
nodePublicHexPrefix = "nodekey:"
|
||||
|
||||
// NodePublicRawLen is the length in bytes of a NodePublic, when
|
||||
// serialized with AppendTo, Raw32 or WriteRawWithoutAllocating.
|
||||
NodePublicRawLen = 32
|
||||
)
|
||||
|
||||
// NodePrivate is a node key, used for WireGuard tunnels and
|
||||
@@ -190,12 +194,6 @@ func (k NodePublic) AppendTo(buf []byte) []byte {
|
||||
return append(buf, k.k[:]...)
|
||||
}
|
||||
|
||||
// RawLen returns the length of k when to the format handled by
|
||||
// ReadRawWithoutAllocating and WriteRawWithoutAllocating.
|
||||
func (k NodePublic) RawLen() int {
|
||||
return 32
|
||||
}
|
||||
|
||||
// ReadRawWithoutAllocating initializes k with bytes read from br.
|
||||
// The reading is done ~4x slower than io.ReadFull, but in exchange is
|
||||
// allocation-free.
|
||||
|
Reference in New Issue
Block a user