mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-20 21:51:42 +00:00
types/key: correct ShortString representation of DiscoPublic.
Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
cb87b7aa5b
commit
073a3ec416
@ -6,6 +6,7 @@ package key
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/subtle"
|
"crypto/subtle"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"go4.org/mem"
|
"go4.org/mem"
|
||||||
"golang.org/x/crypto/curve25519"
|
"golang.org/x/crypto/curve25519"
|
||||||
@ -92,10 +93,12 @@ func (k DiscoPublic) IsZero() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ShortString returns the Tailscale conventional debug representation
|
// ShortString returns the Tailscale conventional debug representation
|
||||||
// of a public key: the first five base64 digits of the key, in square
|
// of a disco key.
|
||||||
// brackets.
|
|
||||||
func (k DiscoPublic) ShortString() string {
|
func (k DiscoPublic) ShortString() string {
|
||||||
return debug32(k.k)
|
if k.IsZero() {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("d:%x", k.k[:8])
|
||||||
}
|
}
|
||||||
|
|
||||||
// AppendTo appends k, serialized as a 32-byte binary value, to
|
// AppendTo appends k, serialized as a 32-byte binary value, to
|
||||||
|
Loading…
x
Reference in New Issue
Block a user